Babbler / app.py
Kryko7
Update app.py
023ea2b
raw
history blame
358 Bytes
from fastapi import FastAPI
from transformers import pipeline
app = FastAPI()
pipe = pipeline("text-generation", model="google/flan-t5-small")
@app.get("/")
def generate(query: str):
output = pipe(query, max_length=50, do_sample=True, top_k=50)
return {"output": output[0]["generated_text"], "query": query, "model": "google/flan-t5-small"}