| 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() | |
| 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} |