PoCInnovation / main.py
remosleandre
[TEST] push
c3e46dc
raw
history blame
703 Bytes
# Line for test push
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from starlette.responses import FileResponse
from transformers import pipeline
app = FastAPI()
# Initialiser le pipeline pour Flan T5
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
# Route d'inférence
@app.get("/infer_t5")
async def infer_t5(input: str):
output = pipe_flan(input)
return {"output": output[0]["generated_text"]}
# Monter les fichiers statiques
app.mount("/", StaticFiles(directory="front/dist", html=True), name="static")
@app.get("/")
async def index() -> FileResponse:
return FileResponse(path="front/dist/index.html", media_type="text/html")