vancauwe commited on
Commit
bbe71e4
·
1 Parent(s): b493bab

feat: subdropdowns created from config

Browse files
app/assets/destruction.png DELETED
Binary file (21.2 kB)
 
app/assets/dropdowns/dropdown_config.json CHANGED
@@ -3,12 +3,14 @@
3
  {
4
  "road vehicle":
5
  {
6
- "road type": {"Options" : ["highway", "main road", "secondary road", "local road/path/trail", "parking lot", "other", "unknown"]},
7
- "infrastructure number": "Open"
 
 
8
  },
9
  "train":
10
  {
11
- "infrastructure number": "Open"
12
  },
13
  "aircraft": {},
14
  "boat": {},
@@ -41,51 +43,34 @@
41
  {
42
  "pylone and electric grid":
43
  {
44
- "object":
45
- {
46
- "Options": ["electric line", "pole/pylon", "other", "unknown"]
47
- },
48
- "cause":
49
- {
50
- "Options": ["collision", "electrocution", "unknown"]
51
- }
52
  },
53
  "windfarm": {},
54
  "other collision":
55
  {
56
- "Object":
57
- {
58
- "Options": ["window", "building", "lighthouse", "cable", "wire fence/barbed wire", "other crash", "unknown"]
59
- }
60
  },
61
  "fall":
62
  {
63
- "Object":
64
- {
65
- "Options": ["chimney", "empty pole", "hole/well", "other", "unknown"]
66
- }
67
  },
68
  "development work":
69
  {
70
- "Type":
71
- {
72
- "Options": ["transport infrastructure", "building", "other", "unknown"]
73
- }
74
  },
75
  "pollution / contamination":
76
  {
77
- "Type":
78
- {
79
- "Options": ["oil pollution", "chemical pollution", "heavy metals", "light", "noise", "plastic ingestion", "other", "unknown"]
80
- }
81
  },
82
  "agricultural net protection": {},
83
  "vegetal / forest work":
84
  {
85
- "Type":
86
- {
87
- "Options": ["clearing/mowing/plowing", "tree felling/pruning", "other", "unknown"]
88
- }
89
  },
90
  "other": {},
91
  "unknown": {}
@@ -94,34 +79,22 @@
94
  {
95
  "predation":
96
  {
97
- "responsible":
98
- {
99
- "Options": ["cat", "dog", "rooster/hen", "other domestic animal", "wild birds", "wild mammal", "other", "unknown"]
100
- }
101
  },
102
  "weather":
103
  {
104
- "Type":
105
- {
106
- "Options": ["cold wave", "drought", "hail", "lightening", "storm", "other", "unknown"]
107
- }
108
  },
109
  "natural disaster":
110
  {
111
- "Type":
112
- {
113
- "Options": ["fire", "avalanche", "rock fall", "mudslide", "volcanic eruption/ashes", "other", "unknown"]
114
- }
115
  },
116
  "nest fall": {},
117
- "strading due to exhaustion": {},
118
  "disease/parasite": {},
119
  "accidental drowing":
120
  {
121
- "Container":
122
- {
123
- "Options": ["drinking trough", "pool", "storm pool", "irrigation pool", "natural pool", "flood", "other container", "unknown"]
124
- }
125
  },
126
  "other": {},
127
  "unknown": {}
 
3
  {
4
  "road vehicle":
5
  {
6
+
7
+ "Options": ["highway", "main road", "secondary road", "local road/path/trail", "parking lot", "other", "unknown"],
8
+ "Open": "Infrastructure number"
9
+
10
  },
11
  "train":
12
  {
13
+ "Open": "Infrastructure"
14
  },
15
  "aircraft": {},
16
  "boat": {},
 
43
  {
44
  "pylone and electric grid":
45
  {
46
+
47
+ "Options": ["electric line", "pole/pylon", "other", "unknown"],
48
+ "Extra":
49
+ {
50
+ "Cause": ["collision", "electrocution", "unknown"]
51
+ }
 
 
52
  },
53
  "windfarm": {},
54
  "other collision":
55
  {
56
+ "Options": ["window", "building", "lighthouse", "cable", "wire fence/barbed wire", "other crash", "unknown"]
 
 
 
57
  },
58
  "fall":
59
  {
60
+ "Options": ["chimney", "empty pole", "hole/well", "other", "unknown"]
 
 
 
61
  },
62
  "development work":
63
  {
64
+ "Options": ["transport infrastructure", "building", "other", "unknown"]
 
 
 
65
  },
66
  "pollution / contamination":
67
  {
68
+ "Options": ["oil pollution", "chemical pollution", "heavy metals", "light", "noise", "plastic ingestion", "other", "unknown"]
 
 
 
69
  },
70
  "agricultural net protection": {},
71
  "vegetal / forest work":
72
  {
73
+ "Options": ["clearing/mowing/plowing", "tree felling/pruning", "other", "unknown"]
 
 
 
74
  },
75
  "other": {},
76
  "unknown": {}
 
79
  {
80
  "predation":
81
  {
82
+ "Options": ["cat", "dog", "rooster/hen", "other domestic animal", "wild birds", "wild mammal", "other", "unknown"]
 
 
 
83
  },
84
  "weather":
85
  {
86
+ "Options": ["cold wave", "drought", "hail", "lightening", "storm", "other", "unknown"]
 
 
 
87
  },
88
  "natural disaster":
89
  {
90
+ "Options": ["fire", "avalanche", "rock fall", "mudslide", "volcanic eruption/ashes", "other", "unknown"]
 
 
 
91
  },
92
  "nest fall": {},
93
+ "stranding due to exhaustion": {},
94
  "disease/parasite": {},
95
  "accidental drowing":
96
  {
97
+ "Options": ["drinking trough", "pool", "storm pool", "irrigation pool", "natural pool", "flood", "other container", "unknown"]
 
 
 
98
  },
99
  "other": {},
100
  "unknown": {}
app/assets/dropdowns/{submit_config.json → followup_config.json} RENAMED
File without changes
app/assets/indirect.png DELETED
Binary file (16.6 kB)
 
app/assets/logos/destruction.png ADDED
app/assets/logos/indirect.png ADDED
app/assets/logos/natural.png ADDED
app/assets/logos/van.png ADDED
app/assets/natural.png DELETED
Binary file (15.9 kB)
 
app/assets/van.png DELETED
Binary file (21.5 kB)
 
app/dead.py CHANGED
@@ -3,10 +3,10 @@ from top_section import create_top_section, create_dropdown
3
 
4
  def show_section_dead(visible):
5
  with gr.Column(visible=visible) as section_dead:
6
- gr.Markdown("# Dead")
7
  gr.Markdown("Please describe the cause of death")
8
 
9
  image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause = create_top_section(visible)
10
- dropdown_row, dropdown = create_dropdown(visible)
11
 
12
- return section_dead, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown
 
3
 
4
  def show_section_dead(visible):
5
  with gr.Column(visible=visible) as section_dead:
6
+ gr.Markdown("# Dead Animal")
7
  gr.Markdown("Please describe the cause of death")
8
 
9
  image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause = create_top_section(visible)
10
+ dropdown_row, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_dropdown(visible)
11
 
12
+ return section_dead, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2
app/dropdowns.py CHANGED
@@ -7,31 +7,86 @@ def load_config(file_path):
7
  config = json.load(f)
8
  return config
9
 
10
- def retrieve_config_options(label):
11
  path = os.getcwd()
12
  dropdown_config_path = path + "/assets/dropdowns/dropdown_config.json"
13
  dropdown_config = load_config(dropdown_config_path)
 
 
 
 
 
14
  options = list(dropdown_config[label].keys())
15
  options = [option.title() for option in options]
16
  return options
17
 
 
 
 
 
 
18
 
 
 
 
 
 
 
19
  def dropdown_collision():
20
  label = "Collision with a means of transport"
21
- options = retrieve_config_options(label)
22
- return gr.Dropdown(choices=options, label=label, interactive=True)
23
 
24
  def dropdown_deliberate_destruction():
25
  label = "Destruction / Deliberatly removed"
26
- options = retrieve_config_options(label)
27
- return gr.Dropdown(choices=options, label=label, interactive=True)
28
 
29
  def dropdown_indirect_destruction():
30
  label = "Indirect destruction"
31
- options = retrieve_config_options(label)
32
- return gr.Dropdown(choices=options, label=label, interactive=True)
33
 
34
  def dropdown_natural_cause():
35
  label = "Natural cause"
36
- options = retrieve_config_options(label)
37
- return gr.Dropdown(choices=options, label=label, interactive=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  config = json.load(f)
8
  return config
9
 
10
+ def get_custom_config_dropdowns():
11
  path = os.getcwd()
12
  dropdown_config_path = path + "/assets/dropdowns/dropdown_config.json"
13
  dropdown_config = load_config(dropdown_config_path)
14
+ return dropdown_config
15
+
16
+ #--------------------------------------------------------- LEVEL 1 DROPDOWNS
17
+ def retrieve_config_options(label):
18
+ dropdown_config = get_custom_config_dropdowns()
19
  options = list(dropdown_config[label].keys())
20
  options = [option.title() for option in options]
21
  return options
22
 
23
+ def reinitialise_level2():
24
+ dropdown_level2 = gr.Dropdown(choices=[], visible=False)
25
+ openfield_level2 = gr.Textbox(visible=False)
26
+ dropdown_extra_level2 = gr.Dropdown(choices=[], visible=False)
27
+ return dropdown_level2, openfield_level2, dropdown_extra_level2
28
 
29
+ def create_dropdown_level1(label):
30
+ options = retrieve_config_options(label)
31
+ dropdown = gr.Dropdown(choices=options, label=label, interactive=True)
32
+ dropdown_level2, openfield_level2, dropdown_extra_level2 = reinitialise_level2()
33
+ return dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2
34
+
35
  def dropdown_collision():
36
  label = "Collision with a means of transport"
37
+ return create_dropdown_level1(label)
 
38
 
39
  def dropdown_deliberate_destruction():
40
  label = "Destruction / Deliberatly removed"
41
+ return create_dropdown_level1(label)
 
42
 
43
  def dropdown_indirect_destruction():
44
  label = "Indirect destruction"
45
+ return create_dropdown_level1(label)
 
46
 
47
  def dropdown_natural_cause():
48
  label = "Natural cause"
49
+ return create_dropdown_level1(label)
50
+
51
+
52
+ #--------------------------------------------------------- LEVEL 2 DROPDOWNS
53
+ def get_options(value):
54
+ value = value.lower()
55
+ options_dropdown= None
56
+ open_field = None
57
+ extras = None
58
+ extras_label = None
59
+ dropdown_config = get_custom_config_dropdowns()
60
+ for _, sub_dict in dropdown_config.items():
61
+ nested_dict = sub_dict.get(value)
62
+ if nested_dict is not None:
63
+ if "Options" in nested_dict.keys():
64
+ options_dropdown = nested_dict["Options"]
65
+ options_dropdown = [option.title() for option in options_dropdown]
66
+ if "Open" in nested_dict.keys():
67
+ open_field = nested_dict["Open"]
68
+ open_field = open_field.title()
69
+ if "Extra" in nested_dict.keys():
70
+ for key, val in nested_dict["Extra"].items():
71
+ extras_label = key
72
+ extras = val
73
+ extras = [extra.title() for extra in extras]
74
+ return options_dropdown, open_field, extras, extras_label
75
+
76
+ def on_select(evt: gr.SelectData): # SelectData is a subclass of EventData
77
+ options_dropdown, open_field, extras, extras_label = get_options(evt.value)
78
+ if options_dropdown is not None:
79
+ dropdown_level2 = gr.Dropdown(choices=options_dropdown, label=evt.value, interactive=True, visible=True)
80
+ else:
81
+ dropdown_level2 = gr.Dropdown(choices=[], visible=False)
82
+
83
+ if open_field is not None:
84
+ openfield_level2 = gr.Textbox(label=open_field, interactive=True, visible=True)
85
+ else:
86
+ openfield_level2 = gr.Textbox(visible=False)
87
+
88
+ if extras is not None:
89
+ dropdown_extra_level2 = gr.Dropdown(choices=extras, label=extras_label, interactive=True, visible=True)
90
+ else:
91
+ dropdown_extra_level2 = gr.Dropdown(choices=[], visible=False)
92
+ return dropdown_level2, openfield_level2, dropdown_extra_level2
app/main.py CHANGED
@@ -7,15 +7,21 @@ from maps import get_location
7
  from style import *
8
 
9
  with gr.Blocks() as demo:
 
 
10
  with gr.Row():
11
  with gr.Column(scale=1):
12
  title = gr.Markdown("# Welcome to Digiwild", label="Title")
13
  description = gr.Markdown("Lorem ipsum", label="description")
14
 
 
 
15
  with gr.Row():
16
  with gr.Column(scale=1):
17
  camera = gr.Image()
18
-
 
 
19
  with gr.Row():
20
  with gr.Column(scale=1):
21
  location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
@@ -33,7 +39,8 @@ with gr.Blocks() as demo:
33
  submit_location.click(get_location, inputs=[location], outputs=[identified_location])
34
 
35
 
36
-
 
37
  with gr.Row() as block_form:
38
  with gr.Column(scale=1):
39
  butt_dead = gr.Button("Dead")
@@ -41,47 +48,57 @@ with gr.Blocks() as demo:
41
  with gr.Column(scale=1):
42
  butt_wounded = gr.Button("Wounded")
43
 
 
44
  # Initiate sections
45
- section_dead, button_collision_dead, button_deliberate_destruction_dead, button_indirect_destruction_dead, button_natural_cause_dead, dropdown_dead = show_section_dead(False)
46
- section_wounded, button_collision_wounded, button_deliberate_destruction_wounded, button_indirect_destruction_wounded, button_natural_cause_wounded, dropdown_wounded = show_section_wounded(False)
47
 
 
48
  # Dead Button Logic
49
  partial_show_section_dead = partial(show_section_dead, True)
50
  partial_hide_section_wounded = partial(show_section_wounded, False)
51
  butt_dead.click(partial_show_section_dead, inputs=None, outputs=[section_dead,
52
  button_collision_dead, button_deliberate_destruction_dead, button_indirect_destruction_dead, button_natural_cause_dead,
53
- dropdown_dead
54
  ])
55
  butt_dead.click(partial_hide_section_wounded, inputs=None, outputs=[section_wounded,
56
  button_collision_wounded, button_deliberate_destruction_wounded, button_indirect_destruction_wounded, button_natural_cause_wounded,
57
- dropdown_wounded
58
  ])
59
-
60
  # Wounded Button Logic
61
  partial_show_section_wounded = partial(show_section_wounded, True)
62
  partial_hide_section_dead = partial(show_section_dead, False)
63
  butt_wounded.click(partial_show_section_wounded, inputs=None, outputs=[section_wounded,
64
  button_collision_wounded, button_deliberate_destruction_wounded, button_indirect_destruction_wounded, button_natural_cause_wounded,
65
- dropdown_wounded
66
  ])
67
  butt_wounded.click(partial_hide_section_dead, inputs=None, outputs=[section_dead,
68
  button_collision_dead, button_deliberate_destruction_dead, button_indirect_destruction_dead, button_natural_cause_dead,
69
- dropdown_dead
70
  ])
71
-
72
  # Dropdowns Dead
73
- button_collision_dead.click(dropdown_collision, outputs=dropdown_dead)
74
- button_deliberate_destruction_dead.click(dropdown_deliberate_destruction, outputs=dropdown_dead)
75
- button_indirect_destruction_dead.click(dropdown_indirect_destruction, outputs=dropdown_dead)
76
- button_natural_cause_dead.click(dropdown_natural_cause, outputs=dropdown_dead)
 
 
 
77
 
78
- # Dropdwons Wounded
79
- button_collision_wounded.click(dropdown_collision, outputs=dropdown_wounded)
80
- button_deliberate_destruction_wounded.click(dropdown_deliberate_destruction, outputs=dropdown_wounded)
81
- button_indirect_destruction_wounded.click(dropdown_indirect_destruction, outputs=dropdown_wounded)
82
- button_natural_cause_wounded.click(dropdown_natural_cause, outputs=dropdown_wounded)
 
 
83
 
 
84
 
 
 
85
  with gr.Column(scale=1):
86
  subbutt = gr.Button("Submit")
87
  output_message = gr.Markdown("Thank you, you didn't save this one but you could save the next")
 
7
  from style import *
8
 
9
  with gr.Blocks() as demo:
10
+ # ---------------------------------------------------------
11
+ # Intro Text
12
  with gr.Row():
13
  with gr.Column(scale=1):
14
  title = gr.Markdown("# Welcome to Digiwild", label="Title")
15
  description = gr.Markdown("Lorem ipsum", label="description")
16
 
17
+ # ---------------------------------------------------------
18
+ # Camera
19
  with gr.Row():
20
  with gr.Column(scale=1):
21
  camera = gr.Image()
22
+
23
+ # ---------------------------------------------------------
24
+ # Location
25
  with gr.Row():
26
  with gr.Column(scale=1):
27
  location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
 
39
  submit_location.click(get_location, inputs=[location], outputs=[identified_location])
40
 
41
 
42
+ # ---------------------------------------------------------
43
+ # Dead and Wounded Buttons
44
  with gr.Row() as block_form:
45
  with gr.Column(scale=1):
46
  butt_dead = gr.Button("Dead")
 
48
  with gr.Column(scale=1):
49
  butt_wounded = gr.Button("Wounded")
50
 
51
+ # ---------------------------------------------------------
52
  # Initiate sections
53
+ section_dead, button_collision_dead, button_deliberate_destruction_dead, button_indirect_destruction_dead, button_natural_cause_dead, dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead = show_section_dead(False)
54
+ section_wounded, button_collision_wounded, button_deliberate_destruction_wounded, button_indirect_destruction_wounded, button_natural_cause_wounded, dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded= show_section_wounded(False)
55
 
56
+ # ---------------------------------------------------------
57
  # Dead Button Logic
58
  partial_show_section_dead = partial(show_section_dead, True)
59
  partial_hide_section_wounded = partial(show_section_wounded, False)
60
  butt_dead.click(partial_show_section_dead, inputs=None, outputs=[section_dead,
61
  button_collision_dead, button_deliberate_destruction_dead, button_indirect_destruction_dead, button_natural_cause_dead,
62
+ dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead
63
  ])
64
  butt_dead.click(partial_hide_section_wounded, inputs=None, outputs=[section_wounded,
65
  button_collision_wounded, button_deliberate_destruction_wounded, button_indirect_destruction_wounded, button_natural_cause_wounded,
66
+ dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded
67
  ])
68
+ # ---------------------------------------------------------
69
  # Wounded Button Logic
70
  partial_show_section_wounded = partial(show_section_wounded, True)
71
  partial_hide_section_dead = partial(show_section_dead, False)
72
  butt_wounded.click(partial_show_section_wounded, inputs=None, outputs=[section_wounded,
73
  button_collision_wounded, button_deliberate_destruction_wounded, button_indirect_destruction_wounded, button_natural_cause_wounded,
74
+ dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded
75
  ])
76
  butt_wounded.click(partial_hide_section_dead, inputs=None, outputs=[section_dead,
77
  button_collision_dead, button_deliberate_destruction_dead, button_indirect_destruction_dead, button_natural_cause_dead,
78
+ dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead
79
  ])
80
+ # ---------------------------------------------------------
81
  # Dropdowns Dead
82
+ button_collision_dead.click(dropdown_collision,
83
+ outputs=[dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead])
84
+ button_deliberate_destruction_dead.click(dropdown_deliberate_destruction, outputs=[dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead])
85
+ button_indirect_destruction_dead.click(dropdown_indirect_destruction, outputs=[dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead])
86
+ button_natural_cause_dead.click(dropdown_natural_cause, outputs=[dropdown_dead, dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead])
87
+
88
+ dropdown_dead.select(on_select, None, [dropdown_level2_dead, openfield_level2_dead, dropdown_extra_level2_dead])
89
 
90
+ # ---------------------------------------------------------
91
+ # Dropdowns Wounded
92
+ button_collision_wounded.click(dropdown_collision,
93
+ outputs=[dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded])
94
+ button_deliberate_destruction_wounded.click(dropdown_deliberate_destruction, outputs=[dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded])
95
+ button_indirect_destruction_wounded.click(dropdown_indirect_destruction, outputs=[dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded])
96
+ button_natural_cause_wounded.click(dropdown_natural_cause, outputs=[dropdown_wounded, dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded])
97
 
98
+ dropdown_wounded.select(on_select, None, [dropdown_level2_wounded, openfield_level2_wounded, dropdown_extra_level2_wounded])
99
 
100
+ # ---------------------------------------------------------
101
+ #Submit Button
102
  with gr.Column(scale=1):
103
  subbutt = gr.Button("Submit")
104
  output_message = gr.Markdown("Thank you, you didn't save this one but you could save the next")
app/top_section.py CHANGED
@@ -1,23 +1,25 @@
1
  import gradio as gr
 
 
 
2
 
3
  def create_top_section(visible):
4
  with gr.Row() as image_row:
5
  with gr.Column(scale=1, min_width="50px"):
6
- img1 = gr.Image(value='app/assets/van.png', show_download_button=False, show_label=False)
 
7
  button_collision = gr.Button("Collision with a means of transport", visible=visible)
8
 
9
  with gr.Column(scale=1, min_width="50px"):
10
- img2 = gr.Image(value='app/assets/destruction.png', show_download_button=False, show_label=False)
11
  button_deliberate_destruction = gr.Button("Destruction / Deliberatly removed", visible=visible)
12
-
13
-
14
- #with gr.Row():
15
  with gr.Column(scale=1, min_width="50px"):
16
- img3 = gr.Image(value='app/assets/indirect.png', show_download_button=False, show_label=False)
17
  button_indirect_destruction = gr.Button("Indirect destruction", visible=visible)
18
 
19
  with gr.Column(scale=1, min_width="50px"):
20
- img4 = gr.Image(value='app/assets/natural.png', show_download_button=False, show_label=False)
21
  button_natural_cause = gr.Button("Natural cause", visible=visible)
22
  return image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause
23
 
@@ -25,7 +27,10 @@ def create_dropdown(visible):
25
  print(visible)
26
  with gr.Row() as dropdown_row:
27
  dropdown = gr.Dropdown(choices=[], label="Dropdown", interactive=True, visible=visible)
28
- return dropdown_row, dropdown
 
 
 
29
 
30
 
31
 
 
1
  import gradio as gr
2
+ import os
3
+
4
+ PATH = os.getcwd()
5
 
6
  def create_top_section(visible):
7
  with gr.Row() as image_row:
8
  with gr.Column(scale=1, min_width="50px"):
9
+ print(PATH + '/assets/logos/van.png')
10
+ img1 = gr.Image(value=PATH + '/assets/logos/van.png', show_download_button=False, show_label=False, height="150px")
11
  button_collision = gr.Button("Collision with a means of transport", visible=visible)
12
 
13
  with gr.Column(scale=1, min_width="50px"):
14
+ img2 = gr.Image(value=PATH + '/assets/logos/destruction.png', show_download_button=False, show_label=False, height="150px")
15
  button_deliberate_destruction = gr.Button("Destruction / Deliberatly removed", visible=visible)
16
+
 
 
17
  with gr.Column(scale=1, min_width="50px"):
18
+ img3 = gr.Image(value=PATH + '/assets/logos/indirect.png', show_download_button=False, show_label=False, height="150px")
19
  button_indirect_destruction = gr.Button("Indirect destruction", visible=visible)
20
 
21
  with gr.Column(scale=1, min_width="50px"):
22
+ img4 = gr.Image(value=PATH + '/assets/logos/natural.png', show_download_button=False, show_label=False, height="150px")
23
  button_natural_cause = gr.Button("Natural cause", visible=visible)
24
  return image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause
25
 
 
27
  print(visible)
28
  with gr.Row() as dropdown_row:
29
  dropdown = gr.Dropdown(choices=[], label="Dropdown", interactive=True, visible=visible)
30
+ openfield_level2 = gr.Textbox(visible=False)
31
+ dropdown_level2 = gr.Dropdown(choices=[], visible=False)
32
+ dropdown_extra_level2 = gr.Dropdown(choices=[], visible=False)
33
+ return dropdown_row, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2
34
 
35
 
36
 
app/wounded.py CHANGED
@@ -4,10 +4,11 @@ from top_section import create_top_section, create_dropdown
4
  def show_section_wounded(visible):
5
  #with gr.Tab("Wounded Information"):
6
  with gr.Column(visible=visible) as wounded_section:
7
- gr.Markdown("# Please describe the cause of wound")
 
8
 
9
  image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause = create_top_section(visible)
10
- dropdown_row, dropdown = create_dropdown(visible)
11
 
12
  # Change variables and names
13
- return wounded_section, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown
 
4
  def show_section_wounded(visible):
5
  #with gr.Tab("Wounded Information"):
6
  with gr.Column(visible=visible) as wounded_section:
7
+ gr.Markdown("# Wounded Animal")
8
+ gr.Markdown("Please describe the wound's cause.")
9
 
10
  image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause = create_top_section(visible)
11
+ dropdown_row, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_dropdown(visible)
12
 
13
  # Change variables and names
14
+ return wounded_section, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2