rdezwart commited on
Commit
1d43352
·
1 Parent(s): 3c20c07

Try changing interactive state another different way

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -78,9 +78,8 @@ def gallery_selected(evt: gr.SelectData):
78
 
79
  :return: index of the currently selected image
80
  """
81
- proceed_button.interactive = gr.Button(interactive=evt.selected)
82
  print(f"Index: {evt.index}, Value: {evt.value}, Selected: {evt.selected}")
83
- return evt.index
84
 
85
 
86
  if __name__ == "__main__":
@@ -115,7 +114,7 @@ if __name__ == "__main__":
115
 
116
  # --- YOLOS --- #
117
  yolos_submit.click(detect_objects, [yolos_input], yolos_output)
118
- yolos_output.select(gallery_selected, None, yolos_selected)
119
 
120
  # --- Moondream --- #
121
  moon_submit.click(answer_question, [moon_img, moon_prompt], moon_output)
 
78
 
79
  :return: index of the currently selected image
80
  """
 
81
  print(f"Index: {evt.index}, Value: {evt.value}, Selected: {evt.selected}")
82
+ return evt.index, gr.Button(interactive=evt.selected)
83
 
84
 
85
  if __name__ == "__main__":
 
114
 
115
  # --- YOLOS --- #
116
  yolos_submit.click(detect_objects, [yolos_input], yolos_output)
117
+ yolos_output.change(gallery_selected, None, [yolos_selected, proceed_button])
118
 
119
  # --- Moondream --- #
120
  moon_submit.click(answer_question, [moon_img, moon_prompt], moon_output)