Spaces:
Runtime error
Runtime error
File size: 647 Bytes
613cfbf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
import ollama
app = FastAPI()
@app.get("/infer_t5")
def t5(input):
response = ollama.chat(model='gemma3:4b',
messages=[{
'role': 'user',
'content': 'Describe the image',
'images': ["profile.png"]
}],
# options={"temperature":0.7}
)
return {"output": response['message']['content']}
app.mount("/", StaticFiles(directory="static", html=True), name="static")
@app.get("/")
def index() -> FileResponse:
return FileResponse(path="/app/static/index.html", media_type="text/html") |