Spaces:
Sleeping
Sleeping
Fix: add root_path for HF Spaces proxy /docs support
Browse files
app.py
CHANGED
|
@@ -43,11 +43,13 @@ async def lifespan(app: FastAPI):
|
|
| 43 |
# -------------------------
|
| 44 |
# FastAPI App
|
| 45 |
# -------------------------
|
|
|
|
| 46 |
app = FastAPI(
|
| 47 |
title="RAG Question Answering API",
|
| 48 |
description="FAISS + SentenceTransformers + Groq LLM",
|
| 49 |
version="2.0.0",
|
| 50 |
-
lifespan=lifespan
|
|
|
|
| 51 |
)
|
| 52 |
|
| 53 |
# CORS for React/Node clients
|
|
|
|
| 43 |
# -------------------------
|
| 44 |
# FastAPI App
|
| 45 |
# -------------------------
|
| 46 |
+
# root_path is needed for HF Spaces reverse proxy to serve /docs correctly
|
| 47 |
app = FastAPI(
|
| 48 |
title="RAG Question Answering API",
|
| 49 |
description="FAISS + SentenceTransformers + Groq LLM",
|
| 50 |
version="2.0.0",
|
| 51 |
+
lifespan=lifespan,
|
| 52 |
+
root_path=os.getenv("ROOT_PATH", ""),
|
| 53 |
)
|
| 54 |
|
| 55 |
# CORS for React/Node clients
|