from fastapi import FastAPI | |
app = FastAPI() | |
from transformers import pipeline | |
pipe_flan = pipeline("translation", model="google/flan-t5-small") | |
def t5(input): | |
output = pipe_flan(input) | |
return {"output": output[0]["generated_text"]} | |
app.mount("/", StaticFiles(directory="static", html=True), name="static") | |
def index() -> FileResponse: | |
return FileResponse(path="/app/static/index.html", html=True | |
) |