Jetmaxx commited on
Commit
329a25c
·
verified ·
1 Parent(s): 73248f8
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, UploadFile, File
2
+ from fastapi.responses import JSONResponse
3
+ from PIL import Image
4
+ import io
5
+
6
+ app = FastAPI()
7
+
8
+ @app.get("/")
9
+ def root():
10
+ return {"message": "API is running"}
11
+
12
+ @app.post("/predict")
13
+ async def predict(img: UploadFile = File(...)):
14
+ image = Image.open(io.BytesIO(await img.read()))
15
+
16
+ # Run your ML model here
17
+ result = "Anomaly: Shadowing" # Replace this with your prediction logic
18
+
19
+ return JSONResponse(content={"result": result})