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!"}