File size: 450 Bytes
a57aa35 e3ae7cf dbb812d e3ae7cf 5740992 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import os
os.environ["HF_HOME"] = "/tmp/hf_cache"
os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
from fastapi import FastAPI, File, UploadFile
from vision_model import describe_image
import shutil
app = FastAPI()
@app.post("/vision")
async def process_vision(image: UploadFile = File(...)):
with open("frame.jpg", "wb") as f:
shutil.copyfileobj(image.file, f)
desc = describe_image("frame.jpg")
return {"description": desc} |