jcleee commited on
Commit
45769ea
·
verified ·
1 Parent(s): b65738b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -118,4 +118,21 @@ agent = CodeAgent(
118
  )
119
 
120
  # === LAUNCH UI ===
121
- GradioUI(agent).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  )
119
 
120
  # === LAUNCH UI ===
121
+ # GradioUI(agent).launch() # new change 6:36 - for evaluation API
122
+
123
+ import gradio as gr
124
+
125
+ def run_agent(question):
126
+ try:
127
+ result = agent(question)
128
+ return [str(result)] # API needs list-wrapped string
129
+ except Exception as e:
130
+ return [f"Error: {e}"]
131
+
132
+ # Main launch
133
+ with gr.Blocks() as demo:
134
+ gr.Markdown("### Chat with your agent")
135
+ chatbot_ui = GradioUI(agent)
136
+ gr.Interface(fn=run_agent, inputs="text", outputs="text") # Hidden interface
137
+
138
+ demo.launch()