vancauwe commited on
Commit
cf0242a
·
1 Parent(s): 56b910d

fix: make physical section disappear on clear button

Browse files
app/main_multianimal.py CHANGED
@@ -11,7 +11,7 @@ from wounded import show_section_wounded
11
  from circumstances import show_causes
12
  from circumstances_dropdowns import *
13
  from physical_select_animal import show_physical, find_bounding_box
14
- from physical_checkbox import on_select_body_part
15
  from behavior_checkbox import show_behavior, on_select_behavior
16
  from style import *
17
  from theme import theme, css
@@ -197,7 +197,10 @@ with gr.Blocks(theme=theme, css=css) as demo:
197
  physical_boxes_wounded,
198
  checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs
199
  ])
 
200
  button_clear.click()
 
 
201
  button_df.click(save_individual_to_df,
202
  inputs=[df],
203
  outputs=[df])
@@ -210,8 +213,7 @@ with gr.Blocks(theme=theme, css=css) as demo:
210
  submit_button.click(save_and_rest_df, inputs=[df], outputs=[df])
211
 
212
 
213
-
214
-
215
 
216
  if __name__ == "__main__":
217
  demo.launch(server_name="0.0.0.0", server_port=3333)
 
11
  from circumstances import show_causes
12
  from circumstances_dropdowns import *
13
  from physical_select_animal import show_physical, find_bounding_box
14
+ from physical_checkbox import on_select_body_part, hide_physical
15
  from behavior_checkbox import show_behavior, on_select_behavior
16
  from style import *
17
  from theme import theme, css
 
197
  physical_boxes_wounded,
198
  checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs
199
  ])
200
+
201
  button_clear.click()
202
+ button_clear.click(hide_physical,
203
+ outputs=[checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs])
204
  button_df.click(save_individual_to_df,
205
  inputs=[df],
206
  outputs=[df])
 
213
  submit_button.click(save_and_rest_df, inputs=[df], outputs=[df])
214
 
215
 
216
+
 
217
 
218
  if __name__ == "__main__":
219
  demo.launch(server_name="0.0.0.0", server_port=3333)
app/physical_checkbox.py CHANGED
@@ -72,4 +72,11 @@ def process_body_parts(section, matched_box):
72
  #---------------------------------------------------------
73
 
74
  def on_select_body_part(body_part_checkbox, body_part):
75
- add_data_to_individual("physical_changes_" + body_part, body_part_checkbox)
 
 
 
 
 
 
 
 
72
  #---------------------------------------------------------
73
 
74
  def on_select_body_part(body_part_checkbox, body_part):
75
+ add_data_to_individual("physical_changes_" + body_part, body_part_checkbox)
76
+
77
+ #---------------------------------------------------------
78
+
79
+ def hide_physical():
80
+ checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs = process_body_parts("wounded", "None")
81
+ return checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs
82
+