Spaces:
Sleeping
Sleeping
Update ContentGradio.py
Browse files- ContentGradio.py +18 -0
ContentGradio.py
CHANGED
|
@@ -95,6 +95,23 @@ class ContentAgentUI:
|
|
| 95 |
gr.Markdown("<div id='footer'>Thanks for trying it out!</div>")
|
| 96 |
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
def pass_through_agent(self, agent):
|
| 99 |
# Simulate the agent's response
|
| 100 |
agent_response = agent(self.user_input.value)
|
|
@@ -115,3 +132,4 @@ class ContentAgentUI:
|
|
| 115 |
inputs=self.user_input,
|
| 116 |
outputs=self.output
|
| 117 |
)
|
|
|
|
|
|
| 95 |
gr.Markdown("<div id='footer'>Thanks for trying it out!</div>")
|
| 96 |
|
| 97 |
|
| 98 |
+
def get_agent_response(input_text):
|
| 99 |
+
try:
|
| 100 |
+
# Pass the input to the agent
|
| 101 |
+
output = agent.get_response(input_text)
|
| 102 |
+
|
| 103 |
+
# Return the agent's response
|
| 104 |
+
return output
|
| 105 |
+
except Exception as e:
|
| 106 |
+
# Handle any errors that occur
|
| 107 |
+
return f"Error: {str(e)}"
|
| 108 |
+
|
| 109 |
+
self.user_input.change(
|
| 110 |
+
fn=get_agent_response,
|
| 111 |
+
inputs=self.user_input,
|
| 112 |
+
outputs=self.output
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
def pass_through_agent(self, agent):
|
| 116 |
# Simulate the agent's response
|
| 117 |
agent_response = agent(self.user_input.value)
|
|
|
|
| 132 |
inputs=self.user_input,
|
| 133 |
outputs=self.output
|
| 134 |
)
|
| 135 |
+
|