Spaces:
Sleeping
Sleeping
Add agent test input field
Browse files
app.py
CHANGED
@@ -141,6 +141,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
141 |
results_df = pd.DataFrame(results_log)
|
142 |
return status_message, results_df
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
# --- Build Gradio Interface using Blocks ---
|
146 |
with gr.Blocks() as demo:
|
@@ -173,6 +179,19 @@ with gr.Blocks() as demo:
|
|
173 |
outputs=[status_output, results_table]
|
174 |
)
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
if __name__ == "__main__":
|
177 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
178 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
|
|
141 |
results_df = pd.DataFrame(results_log)
|
142 |
return status_message, results_df
|
143 |
|
144 |
+
async def handle_agent_input(user_input):
|
145 |
+
# TODO initialize agent at a different place
|
146 |
+
agent = BasicAgent()
|
147 |
+
response = await agent(user_input)
|
148 |
+
return response.response.content
|
149 |
+
|
150 |
|
151 |
# --- Build Gradio Interface using Blocks ---
|
152 |
with gr.Blocks() as demo:
|
|
|
179 |
outputs=[status_output, results_table]
|
180 |
)
|
181 |
|
182 |
+
# Input field to test agent
|
183 |
+
with gr.Row():
|
184 |
+
agent_input = gr.Textbox(label="Manual Agent Input", placeholder="Type your query here...")
|
185 |
+
agent_submit = gr.Button("Run")
|
186 |
+
|
187 |
+
agent_output = gr.Textbox(label="Agent Response", interactive=False)
|
188 |
+
|
189 |
+
agent_submit.click(
|
190 |
+
fn=handle_agent_input,
|
191 |
+
inputs=agent_input,
|
192 |
+
outputs=agent_output
|
193 |
+
)
|
194 |
+
|
195 |
if __name__ == "__main__":
|
196 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
197 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|