Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,16 @@
|
|
| 1 |
-
# backend.py (in root of Space repo)
|
| 2 |
-
|
| 3 |
from fastapi import FastAPI
|
| 4 |
from pydantic import BaseModel
|
| 5 |
from qabot import llm_chain
|
| 6 |
-
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
class Query(BaseModel):
|
| 10 |
query: str
|
| 11 |
|
| 12 |
-
@app.get("/")
|
| 13 |
-
def root():
|
| 14 |
-
return {"message": "FastAPI backend is running!"}
|
| 15 |
-
|
| 16 |
@app.post("/ask")
|
| 17 |
def ask_question(query: Query):
|
| 18 |
result = llm_chain.invoke({"query": query.query})
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from pydantic import BaseModel
|
| 3 |
from qabot import llm_chain
|
| 4 |
+
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
+
@app.get("/")
|
| 8 |
+
def health_check():
|
| 9 |
+
return {"status": "FastAPI is running!"}
|
| 10 |
+
|
| 11 |
class Query(BaseModel):
|
| 12 |
query: str
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
@app.post("/ask")
|
| 15 |
def ask_question(query: Query):
|
| 16 |
result = llm_chain.invoke({"query": query.query})
|