Spaces:
Sleeping
Sleeping
File size: 358 Bytes
362b7c9 39df819 362b7c9 6920adf 362b7c9 39df819 6920adf 362b7c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastapi import FastAPI
from transformers import pipeline
app = FastAPI()
pipe = pipeline("text-generation", model="google/flan-t5-small")
@app.post("/generate")
async def generate_text(text:str):
output = pipe(text)
return {"output": output}
@app.get("/")
async def root():
return {"message": "Welcome to the LLM API!"}
|