from fastapi import FastAPI from pydantic import BaseModel from summary import summarize KEY = 'J9l#K4wP5h@2' app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} class SummaryReq(BaseModel): key: str id: str text: str @app.post("/summary/") async def summary(request: SummaryReq): if request.key != KEY: return 'Unauthorized' return summarize(request.id, request.text)