HubRAG / app.py
Zubaish
Final stable HF RAG (dataset-backed, CPU-safe)
2fd2129
raw
history blame contribute delete
521 Bytes
# app.py
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from rag import ask_rag_with_status
app = FastAPI()
class Query(BaseModel):
question: str
@app.get("/", response_class=HTMLResponse)
def index():
with open("frontend/index.html", "r", encoding="utf-8") as f:
return f.read()
@app.post("/chat")
def chat(q: Query):
answer, status = ask_rag_with_status(q.question)
return {
"answer": answer,
"status": status,
}