Pujan-Dev's picture
push to testing branch
b8aa51a
raw
history blame contribute delete
523 Bytes
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)
try:
result = classify_image(image_array)
return result
except:
raise HTTPException(status_code=423, detail="something went wrong")
except Exception as e:
raise HTTPException(status_code=413, detail=str(e))