File size: 346 Bytes
0f5c847 a552062 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from fastapi import FastAPI
from rag import RAG
app = FastAPI()
rag = RAG()
@app.post("/ask")
async def ask_question(payload: dict):
question = payload.get("question", "")
answer = rag.generate_answer(question)
return {"answer": answer}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=7860)
|