34 lines
852 B
Python
34 lines
852 B
Python
from fastapi import APIRouter, HTTPException
|
|
from typing import List
|
|
|
|
images = [] # In-memory storage
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/login")
|
|
async def detect_image(
|
|
image_url: str = "https://example.com/image.jpg",
|
|
detection_type: str = "objects"
|
|
):
|
|
"""Demo image detection endpoint"""
|
|
if not image_url:
|
|
raise HTTPException(status_code=400, detail="Image URL required")
|
|
|
|
# Demo detection response
|
|
detection_result = {
|
|
"message": "Detection successful (demo)",
|
|
"image": image_url,
|
|
"detections": [
|
|
{
|
|
"label": "person",
|
|
"confidence": 0.95,
|
|
"bbox": [100, 200, 300, 400]
|
|
}
|
|
],
|
|
"features": {
|
|
"rate_limit": 100,
|
|
"expires_in": 3600
|
|
}
|
|
}
|
|
|
|
return detection_result |