Spaces:
Sleeping
Sleeping
| from fastapi import APIRouter, UploadFile, File | |
| from PIL import Image | |
| import io | |
| from app.model.predictor import predict_image | |
| router = APIRouter() | |
| async def predict( | |
| file: UploadFile = File(...) | |
| ): | |
| image_bytes = await file.read() | |
| image = Image.open( | |
| io.BytesIO(image_bytes) | |
| ) | |
| result = predict_image(image) | |
| return result |