| from fastapi import FastAPI, UploadFile, File | |
| from fastapi.responses import JSONResponse | |
| from PIL import Image | |
| import io | |
| app = FastAPI() | |
| def root(): | |
| return {"message": "API is running"} | |
| async def predict(img: UploadFile = File(...)): | |
| image = Image.open(io.BytesIO(await img.read())) | |
| # Run your ML model here | |
| result = "Anomaly: Shadowing" # Replace this with your prediction logic | |
| return JSONResponse(content={"result": result}) | |