cafe3310 commited on
Commit
12932a7
·
1 Parent(s): 9079caa

feat: Add send button to UI for automation

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -31,7 +31,12 @@ with gr.Blocks() as demo:
31
  with gr.Column(scale=2):
32
  gr.Markdown("## Chat")
33
  chat_chatbot = gr.Chatbot(label="Chat", bubble_full_width=False)
34
- chat_msg = gr.Textbox(label="Your Message")
 
 
 
 
 
35
 
36
  with gr.Column(scale=1):
37
  gr.Markdown("## Workflow Extraction")
@@ -82,10 +87,17 @@ with gr.Blocks() as demo:
82
  intent, steps = parse_workflow_response(full_response)
83
  return intent, steps
84
 
 
85
  ( chat_msg.submit(user, [chat_msg, chat_chatbot], [chat_msg, chat_chatbot], queue=False)
86
  .then(bot, chat_chatbot, chat_chatbot)
87
  .then(update_workflow, chat_chatbot, [intent_textbox, steps_textbox])
88
  )
89
 
 
 
 
 
 
 
90
  if __name__ == "__main__":
91
  demo.launch(share=True)
 
31
  with gr.Column(scale=2):
32
  gr.Markdown("## Chat")
33
  chat_chatbot = gr.Chatbot(label="Chat", bubble_full_width=False)
34
+ with gr.Row():
35
+ chat_msg = gr.Textbox(
36
+ label="Your Message",
37
+ scale=4,
38
+ )
39
+ send_btn = gr.Button("Send", scale=1)
40
 
41
  with gr.Column(scale=1):
42
  gr.Markdown("## Workflow Extraction")
 
87
  intent, steps = parse_workflow_response(full_response)
88
  return intent, steps
89
 
90
+ # Handler for pressing Enter in the textbox
91
  ( chat_msg.submit(user, [chat_msg, chat_chatbot], [chat_msg, chat_chatbot], queue=False)
92
  .then(bot, chat_chatbot, chat_chatbot)
93
  .then(update_workflow, chat_chatbot, [intent_textbox, steps_textbox])
94
  )
95
 
96
+ # Handler for clicking the Send button
97
+ ( send_btn.click(user, [chat_msg, chat_chatbot], [chat_msg, chat_chatbot], queue=False)
98
+ .then(bot, chat_chatbot, chat_chatbot)
99
+ .then(update_workflow, chat_chatbot, [intent_textbox, steps_textbox])
100
+ )
101
+
102
  if __name__ == "__main__":
103
  demo.launch(share=True)