Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, File, UploadFile
|
| 2 |
+
from vision_model import describe_image
|
| 3 |
+
import shutil
|
| 4 |
+
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
|
| 7 |
+
@app.post("/vision")
|
| 8 |
+
async def process_vision(image: UploadFile = File(...)):
|
| 9 |
+
with open("frame.jpg", "wb") as f:
|
| 10 |
+
shutil.copyfileobj(image.file, f)
|
| 11 |
+
desc = describe_image("frame.jpg")
|
| 12 |
+
return {"description": desc}
|