Spaces:
Sleeping
Sleeping
Update ui/contentagentui.py
Browse files- ui/contentagentui.py +10 -2
ui/contentagentui.py
CHANGED
|
@@ -30,6 +30,7 @@ class ContentAgentUI:
|
|
| 30 |
self.reply = None
|
| 31 |
self.agent_state = None
|
| 32 |
self.examples_radio = None
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
|
|
@@ -154,12 +155,19 @@ class ContentAgentUI:
|
|
| 154 |
# Chat controls
|
| 155 |
self.agent_state = gr.State(None)
|
| 156 |
self.prompt = gr.Textbox(label=strInput, placeholder=strPlaceholder, lines=10)
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
self.reply = gr.Textbox(label=strOutput, interactive=False, lines=12, max_lines=20)
|
| 159 |
-
|
|
|
|
| 160 |
# Use bound methods to submit content
|
| 161 |
submit_btn.click(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
|
| 162 |
self.prompt.submit(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
|
|
|
|
| 163 |
|
| 164 |
|
| 165 |
# Examples (optional)
|
|
|
|
| 30 |
self.reply = None
|
| 31 |
self.agent_state = None
|
| 32 |
self.examples_radio = None
|
| 33 |
+
self.clear = None
|
| 34 |
|
| 35 |
|
| 36 |
|
|
|
|
| 155 |
# Chat controls
|
| 156 |
self.agent_state = gr.State(None)
|
| 157 |
self.prompt = gr.Textbox(label=strInput, placeholder=strPlaceholder, lines=10)
|
| 158 |
+
with gr.Row(equal_height=True):
|
| 159 |
+
|
| 160 |
+
submit_btn = gr.Button(strSubmit)
|
| 161 |
+
self.clear = gr.Button("Clear")
|
| 162 |
+
|
| 163 |
+
|
| 164 |
self.reply = gr.Textbox(label=strOutput, interactive=False, lines=12, max_lines=20)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
# Use bound methods to submit content
|
| 168 |
submit_btn.click(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
|
| 169 |
self.prompt.submit(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
|
| 170 |
+
self.clear.click(fn=lambda: "", outputs=user_text)
|
| 171 |
|
| 172 |
|
| 173 |
# Examples (optional)
|