wi-lab commited on
Commit
ea78540
·
verified ·
1 Parent(s): ca7400a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -579,9 +579,10 @@ with gr.Blocks(css="""
579
 
580
  # Use the theme detection from JavaScript
581
  theme_output = gr.Textbox(label="Theme", visible=False)
582
-
583
- # Run the JS code to detect the theme and set it to theme_output
584
- theme_output.change(fn=None, inputs=[], outputs=[theme_output], _js=js_code)
 
585
 
586
  # Update the confusion matrices whenever sliders change
587
  data_percentage_slider.change(fn=beam_prediction_task, inputs=[data_percentage_slider, task_complexity_dropdown, theme_output], outputs=[raw_img_bp, embeddings_img_bp])
 
579
 
580
  # Use the theme detection from JavaScript
581
  theme_output = gr.Textbox(label="Theme", visible=False)
582
+ # Update the theme on button click (or any event)
583
+ theme_button = gr.Button("Detect Theme")
584
+ # Trigger JS to detect theme and set value to theme_output
585
+ theme_button.click(fn=None, inputs=[], outputs=[theme_output], _js=js_code)
586
 
587
  # Update the confusion matrices whenever sliders change
588
  data_percentage_slider.change(fn=beam_prediction_task, inputs=[data_percentage_slider, task_complexity_dropdown, theme_output], outputs=[raw_img_bp, embeddings_img_bp])