Pudding48 commited on
Commit
69f514f
·
verified ·
1 Parent(s): 0e64714

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,9 +1,17 @@
1
  from fastapi import FastAPI
2
-
 
3
 
4
  app = FastAPI()
5
 
6
-
7
  @app.get("/")
8
- def root():
9
- return {"message": "FastAPI backend is running!"}
 
 
 
 
 
 
 
 
 
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"]}