Spaces:
Running
Running
from slowapi import Limiter | |
from config import ACCESS_RATE | |
from fastapi import APIRouter, File, Request, Depends, HTTPException, UploadFile | |
from fastapi.security import HTTPBearer | |
from slowapi import Limiter | |
from slowapi.util import get_remote_address | |
from .controller import Classify_Image_router | |
router = APIRouter() | |
limiter = Limiter(key_func=get_remote_address) | |
security = HTTPBearer() | |
async def analyse( | |
request: Request, | |
file: UploadFile = File(...), | |
token: str = Depends(security) | |
): | |
result = await Classify_Image_router(file) # await the async function | |
return result | |
def health(request: Request): | |
return {"status": "ok"} | |