limonad commited on
Commit
b87ddcc
·
verified ·
1 Parent(s): fe3bf5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -1,17 +1,17 @@
1
  import gradio as gr
2
-
3
- from agents.process_aware_agent import build_agent # adapt to your actual API
4
-
5
- agent = create_agent_graph()
6
 
7
  def chat_fn(message, history):
8
- # adapt this to however your agent is invoked
9
- result = agent.invoke({"input": message})
10
- if isinstance(result, dict):
11
- return result.get("output") or result.get("answer") or str(result)
12
- return str(result)
13
 
14
- demo = gr.ChatInterface(fn=chat_fn, title="Process-Aware LangGraph Agent")
 
 
 
 
15
 
16
  if __name__ == "__main__":
17
  demo.launch(server_name="0.0.0.0", server_port=7860)
 
1
  import gradio as gr
2
+ from agents.process_aware_agent import run_agent
 
 
 
3
 
4
  def chat_fn(message, history):
5
+ try:
6
+ return run_agent(message)
7
+ except Exception as e:
8
+ return f"Error: {str(e)}"
 
9
 
10
+ demo = gr.ChatInterface(
11
+ fn=chat_fn,
12
+ title="Process-Aware LangGraph Agent",
13
+ description="Chat with a process-aware LangGraph agent."
14
+ )
15
 
16
  if __name__ == "__main__":
17
  demo.launch(server_name="0.0.0.0", server_port=7860)