Spaces:
Running
Running
File size: 402 Bytes
b4f755d |
1 2 3 4 5 6 7 8 9 10 11 12 |
from fastapi import HTTPException,File,UploadFile
from .preprocess import preprocess_image
from .inferencer import classify_image
async def Classify_Image_router(file: UploadFile = File(...)):
try:
image_array = preprocess_image(file)
result = classify_image(image_array)
return result
except Exception as e:
raise HTTPException(status_code=400, detail=str(e))
|