Spaces:
Runtime error
Runtime error
from model import model_pipeline | |
from typing import Union | |
from fastapi import FastAPI, UploadFile | |
import io | |
from PIL import Image | |
app = FastAPI() | |
def read_root(): | |
return {"Hello": "World"} | |
def ask(text: str, image: UploadFile): | |
photos = image.file.read() | |
image = Image.open(io.BytesIO(photos)) | |
result = model_pipeline(text, image) | |
return {"answer": result} | |