m-ric HF Staff commited on
Commit
a590f54
·
1 Parent(s): 1d6ac90

Remove useless button

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -437,6 +437,13 @@ def create_agent(data_dir, desktop, log_file):
437
  )
438
 
439
  class EnrichedGradioUI(GradioUI):
 
 
 
 
 
 
 
440
  def interact_with_agent(self, task_input, messages, session_state, session_hash, request: gr.Request):
441
  import gradio as gr
442
 
@@ -547,7 +554,7 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
547
  update_btn = gr.Button("Let's go!")
548
 
549
  chatbot = gr.Chatbot(
550
- label="Agent logs",
551
  type="messages",
552
  avatar_images=(
553
  None,
@@ -593,7 +600,6 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
593
  # Return the current HTML to avoid changing the display
594
  # This will keep the BSOD visible
595
  return gr.update()
596
- submit_btn = gr.Button("dont click")
597
 
598
  # Chain the events
599
  # 1. Set view-only mode when button is clicked and reset visibility
@@ -603,8 +609,8 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
603
  outputs=[results_output, html_output, results_container]
604
  ).then(
605
  agent_ui.log_user_message,
606
- [task_input, task_input],
607
- [stored_messages, task_input, submit_btn],
608
  ).then(agent_ui.interact_with_agent, [stored_messages, chatbot, session_state, session_hash_state], [chatbot]).then(
609
  lambda: (
610
  gr.Textbox(
@@ -613,7 +619,7 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
613
  gr.Button(interactive=True),
614
  ),
615
  None,
616
- [task_input, submit_btn],
617
  ).then(
618
  fn=check_and_set_interactive,
619
  inputs=[results_output],
 
437
  )
438
 
439
  class EnrichedGradioUI(GradioUI):
440
+ def log_user_message(self, text_input):
441
+ import gradio as gr
442
+
443
+ return (
444
+ text_input,
445
+ gr.Button(interactive=False),
446
+ )
447
  def interact_with_agent(self, task_input, messages, session_state, session_hash, request: gr.Request):
448
  import gradio as gr
449
 
 
554
  update_btn = gr.Button("Let's go!")
555
 
556
  chatbot = gr.Chatbot(
557
+ label="Agent's execution logs",
558
  type="messages",
559
  avatar_images=(
560
  None,
 
600
  # Return the current HTML to avoid changing the display
601
  # This will keep the BSOD visible
602
  return gr.update()
 
603
 
604
  # Chain the events
605
  # 1. Set view-only mode when button is clicked and reset visibility
 
609
  outputs=[results_output, html_output, results_container]
610
  ).then(
611
  agent_ui.log_user_message,
612
+ [task_input],
613
+ [stored_messages, task_input],
614
  ).then(agent_ui.interact_with_agent, [stored_messages, chatbot, session_state, session_hash_state], [chatbot]).then(
615
  lambda: (
616
  gr.Textbox(
 
619
  gr.Button(interactive=True),
620
  ),
621
  None,
622
+ [task_input],
623
  ).then(
624
  fn=check_and_set_interactive,
625
  inputs=[results_output],