Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
-
from fastapi import FastAPI, Request
|
| 2 |
-
from pydantic import BaseModel
|
| 3 |
-
from langgraph_chain import create_graph
|
| 4 |
-
from fastapi import Form
|
| 5 |
-
|
| 6 |
-
app = FastAPI()
|
| 7 |
-
graph = create_graph()
|
| 8 |
-
|
| 9 |
-
class Query(BaseModel):
|
| 10 |
-
question: str
|
| 11 |
-
|
| 12 |
-
@app.get("/")
|
| 13 |
-
def read_root():
|
| 14 |
-
return {"
|
| 15 |
-
|
| 16 |
-
@app.post("/ask")
|
| 17 |
-
def ask_q(question: str = Form(...)):
|
| 18 |
-
result = graph.invoke({"question": question})
|
| 19 |
-
return {"response": result}
|
|
|
|
| 1 |
+
from fastapi import FastAPI, Request
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
from langgraph_chain import create_graph
|
| 4 |
+
from fastapi import Form
|
| 5 |
+
|
| 6 |
+
app = FastAPI()
|
| 7 |
+
graph = create_graph()
|
| 8 |
+
|
| 9 |
+
class Query(BaseModel):
|
| 10 |
+
question: str
|
| 11 |
+
|
| 12 |
+
@app.get("/")
|
| 13 |
+
def read_root():
|
| 14 |
+
return {"Message": "Welcome To Engineer Astra"}
|
| 15 |
+
|
| 16 |
+
@app.post("/ask")
|
| 17 |
+
def ask_q(question: str = Form(...)):
|
| 18 |
+
result = graph.invoke({"question": question})
|
| 19 |
+
return {"response": result}
|