Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,18 +62,20 @@ graph = workflow.compile()
|
|
62 |
# Define the function to run the graph
|
63 |
def run_langgraph(user_input):
|
64 |
# Start with user input
|
65 |
-
|
66 |
{"messages": [("user", user_input)]},
|
67 |
{"recursion_limit": 150}
|
68 |
)
|
69 |
-
|
70 |
-
|
|
|
71 |
for event in events:
|
72 |
if "messages" in event and event["messages"]:
|
73 |
final_message = event["messages"][-1].content
|
74 |
|
75 |
return final_message or "No output generated"
|
76 |
|
|
|
77 |
# Create Gradio interface
|
78 |
def process_input(user_input):
|
79 |
result = run_langgraph(user_input)
|
|
|
62 |
# Define the function to run the graph
|
63 |
def run_langgraph(user_input):
|
64 |
# Start with user input
|
65 |
+
events = graph.stream(
|
66 |
{"messages": [("user", user_input)]},
|
67 |
{"recursion_limit": 150}
|
68 |
)
|
69 |
+
|
70 |
+
# Collect outputs from the workflow
|
71 |
+
final_message = None
|
72 |
for event in events:
|
73 |
if "messages" in event and event["messages"]:
|
74 |
final_message = event["messages"][-1].content
|
75 |
|
76 |
return final_message or "No output generated"
|
77 |
|
78 |
+
|
79 |
# Create Gradio interface
|
80 |
def process_input(user_input):
|
81 |
result = run_langgraph(user_input)
|