Spaces:
Running
Running
✨ feat: add submit button and enhance example questions
Browse files- Gradio_UI.py +9 -1
Gradio_UI.py
CHANGED
@@ -284,13 +284,15 @@ class GradioUI:
|
|
284 |
label="Ask me anything about travel",
|
285 |
placeholder="Type your travel question here...",
|
286 |
)
|
|
|
287 |
gr.Examples(
|
288 |
examples=[
|
289 |
"What is the cheapest month to travel to Tokyo, Japan?",
|
290 |
"Find the best flight options from Denver, Colorado to Tokyo, Japan.",
|
291 |
"What is the typical weather in Tokyo during April?",
|
292 |
"What are the top must-visit attractions in Tokyo for first-time travelers?",
|
293 |
-
"How can I get from Narita Airport to Shinjuku using public transportation?"
|
|
|
294 |
],
|
295 |
inputs=text_input,
|
296 |
label="Example Questions"
|
@@ -301,6 +303,12 @@ class GradioUI:
|
|
301 |
[stored_messages, text_input],
|
302 |
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
demo.launch(debug=True, share=True, **kwargs)
|
305 |
|
306 |
|
|
|
284 |
label="Ask me anything about travel",
|
285 |
placeholder="Type your travel question here...",
|
286 |
)
|
287 |
+
submit_button = gr.Button("Send")
|
288 |
gr.Examples(
|
289 |
examples=[
|
290 |
"What is the cheapest month to travel to Tokyo, Japan?",
|
291 |
"Find the best flight options from Denver, Colorado to Tokyo, Japan.",
|
292 |
"What is the typical weather in Tokyo during April?",
|
293 |
"What are the top must-visit attractions in Tokyo for first-time travelers?",
|
294 |
+
"How can I get from Narita Airport to Shinjuku using public transportation?",
|
295 |
+
"Which airline offers the best service for flights to Tokyo, Japan?"
|
296 |
],
|
297 |
inputs=text_input,
|
298 |
label="Example Questions"
|
|
|
303 |
[stored_messages, text_input],
|
304 |
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
305 |
|
306 |
+
submit_button.click(
|
307 |
+
self.log_user_message,
|
308 |
+
[text_input, file_uploads_log],
|
309 |
+
[stored_messages, text_input],
|
310 |
+
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
311 |
+
|
312 |
demo.launch(debug=True, share=True, **kwargs)
|
313 |
|
314 |
|