Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,24 @@
|
|
| 1 |
-
from
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
|
| 3 |
+
from graph.rag_pipeline_graph import get_rag_pipeline_graph
|
| 4 |
+
from type.state_schema import RAGState
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
api = FastAPI()
|
| 8 |
+
|
| 9 |
+
# if __name__ == "__main__":
|
| 10 |
+
@app.get("/")
|
| 11 |
+
def rag_pipeline_graph():
|
| 12 |
+
graph = get_rag_pipeline_graph()
|
| 13 |
+
|
| 14 |
+
input_data = RAGState(
|
| 15 |
+
query="μ μ©ν μ¬λ¬΄μ 보μ μ§μ νΉμ±μ κ΄ν μ€λͺ
",
|
| 16 |
+
top_k=5
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
final_state = graph.invoke(input_data)
|
| 20 |
+
# print("\nπ§ μ΅μ’
μλ΅:", final_state.final_response)
|
| 21 |
+
# print("\nπ§ μ΅μ’
μλ΅:", final_state["final_response"])
|
| 22 |
+
# print("\nπ§ μ΅μ’
μλ΅:", final_state.get("final_response", "[μλ΅ μμ]"))
|
| 23 |
+
return final_state.get("final_response", "[μλ΅ μμ]")
|
| 24 |
+
|