from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} @app.get("/generate") def generate(text:str): ## use the pipeline to generate text from given input text output=pipe(text) ## return the generate text in Json reposne return {"output":output[0]['generated_text']}