from fastapi import FastAPI from pydantic import BaseModel import uvicorn app = FastAPI() class Item(BaseModel): claim: str source: str @app.get("/") def greet_json(): return {"Hello": "World!"} def generate(item: Item): # return "Claim: " + item['claim'] # python return "Claim: " + item.claim # huggingface space @app.post("/generate/") async def generate_text(item: Item): return {"response": generate(item)} if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=7860)