from fastapi import FastAPI from pydantic import BaseModel import os app = FastAPI() model = load_model() client = MongoClient('mongodb://localhost:27017/') db = client[''] collection = db['text'] class InputData(BaseModel): title: str keywords: str subheadings: str @app.post("/generate/") async def generate(input_data: InputData): result = model.predict(input_data) return {"result": "generated_output"}