Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,17 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
-
|
|
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
6 |
-
|
7 |
@app.get("/")
|
8 |
-
def
|
9 |
-
return {"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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})
|
17 |
+
return {"answer": result["result"]}
|