feat: colored sections
Browse files- .gitignore +3 -0
- app/dead.py +1 -1
- app/main.py +6 -7
- app/theme.py +7 -2
- app/top_section.py +8 -9
- app/wounded.py +1 -1
.gitignore
CHANGED
@@ -5,6 +5,9 @@ __pycache__/
|
|
5 |
*.py[cod]
|
6 |
*$py.class
|
7 |
|
|
|
|
|
|
|
8 |
# C extensions
|
9 |
*.so
|
10 |
|
|
|
5 |
*.py[cod]
|
6 |
*$py.class
|
7 |
|
8 |
+
#Data
|
9 |
+
test/data/**
|
10 |
+
|
11 |
# C extensions
|
12 |
*.so
|
13 |
|
app/dead.py
CHANGED
@@ -3,7 +3,7 @@ from top_section import create_top_section, create_dropdown
|
|
3 |
|
4 |
|
5 |
def show_section_dead(visible):
|
6 |
-
with gr.Column(visible=visible) as section_dead:
|
7 |
gr.Markdown("# Dead Animal")
|
8 |
gr.Markdown("Please describe the cause of death")
|
9 |
|
|
|
3 |
|
4 |
|
5 |
def show_section_dead(visible):
|
6 |
+
with gr.Column(visible=visible, elem_id="dead") as section_dead:
|
7 |
gr.Markdown("# Dead Animal")
|
8 |
gr.Markdown("Please describe the cause of death")
|
9 |
|
app/main.py
CHANGED
@@ -19,7 +19,7 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
19 |
# Camera
|
20 |
with gr.Row():
|
21 |
with gr.Column(scale=1):
|
22 |
-
camera = gr.Image()
|
23 |
|
24 |
# ---------------------------------------------------------
|
25 |
# Location
|
@@ -31,8 +31,7 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
31 |
label="Identified GPS Location")
|
32 |
with gr.Row():
|
33 |
#to clear it
|
34 |
-
clear_location = gr.ClearButton(components=[location], visible=True, interactive=True
|
35 |
-
#elem_classes=["custom-button"]
|
36 |
)
|
37 |
clear_location.click()
|
38 |
#to submit it
|
@@ -44,10 +43,10 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
44 |
# Dead and Wounded Buttons
|
45 |
with gr.Row() as block_form:
|
46 |
with gr.Column(scale=1):
|
47 |
-
butt_dead = gr.Button("Dead")
|
48 |
|
49 |
with gr.Column(scale=1):
|
50 |
-
butt_wounded = gr.Button("Wounded")
|
51 |
|
52 |
# ---------------------------------------------------------
|
53 |
# Initiate sections
|
@@ -101,8 +100,8 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
101 |
# ---------------------------------------------------------
|
102 |
#Submit Button
|
103 |
with gr.Column(scale=1):
|
104 |
-
subbutt = gr.Button("Submit")
|
105 |
-
output_message = gr.Markdown("Thank you, you
|
106 |
|
107 |
|
108 |
|
|
|
19 |
# Camera
|
20 |
with gr.Row():
|
21 |
with gr.Column(scale=1):
|
22 |
+
camera = gr.Image(elem_id="image")
|
23 |
|
24 |
# ---------------------------------------------------------
|
25 |
# Location
|
|
|
31 |
label="Identified GPS Location")
|
32 |
with gr.Row():
|
33 |
#to clear it
|
34 |
+
clear_location = gr.ClearButton(components=[location], visible=True, interactive=True
|
|
|
35 |
)
|
36 |
clear_location.click()
|
37 |
#to submit it
|
|
|
43 |
# Dead and Wounded Buttons
|
44 |
with gr.Row() as block_form:
|
45 |
with gr.Column(scale=1):
|
46 |
+
butt_dead = gr.Button("Dead", elem_id="dead")
|
47 |
|
48 |
with gr.Column(scale=1):
|
49 |
+
butt_wounded = gr.Button("Wounded", elem_id="wounded")
|
50 |
|
51 |
# ---------------------------------------------------------
|
52 |
# Initiate sections
|
|
|
100 |
# ---------------------------------------------------------
|
101 |
#Submit Button
|
102 |
with gr.Column(scale=1):
|
103 |
+
subbutt = gr.Button("Submit", elem_id="submit")
|
104 |
+
output_message = gr.Markdown("Thank you, you are a champion of biodiversity conservation !")
|
105 |
|
106 |
|
107 |
|
app/theme.py
CHANGED
@@ -2,9 +2,14 @@ import gradio as gr
|
|
2 |
|
3 |
css = """
|
4 |
.gradio-container {background: url(https://openclipart.org/image/2000px/279687)}
|
5 |
-
#
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
"""
|
8 |
|
|
|
9 |
theme = gr.themes.Soft(primary_hue="teal", secondary_hue="teal", neutral_hue="emerald",
|
10 |
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"])
|
|
|
2 |
|
3 |
css = """
|
4 |
.gradio-container {background: url(https://openclipart.org/image/2000px/279687)}
|
5 |
+
#image {background-color: #73b9ae}
|
6 |
+
#dead {background-color: #13422f}
|
7 |
+
#wounded {background-color: #2d5543}
|
8 |
+
#buttons-conditions {background-color: #5f7d6e}
|
9 |
+
#dropdown-conditions {background-color: #92a69c}
|
10 |
+
#submit {background-color: #333333}
|
11 |
"""
|
12 |
|
13 |
+
|
14 |
theme = gr.themes.Soft(primary_hue="teal", secondary_hue="teal", neutral_hue="emerald",
|
15 |
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"])
|
app/top_section.py
CHANGED
@@ -7,28 +7,27 @@ def create_top_section(visible):
|
|
7 |
with gr.Row() as image_row:
|
8 |
with gr.Column(scale=1, min_width="50px"):
|
9 |
img1 = gr.Image(value=PATH + '/assets/logos/van.png', show_download_button=False, show_label=False, height="150px")
|
10 |
-
button_collision = gr.Button("Collision with a means of transport", visible=visible, elem_id="
|
11 |
|
12 |
with gr.Column(scale=1, min_width="50px"):
|
13 |
img2 = gr.Image(value=PATH + '/assets/logos/destruction.png', show_download_button=False, show_label=False, height="150px")
|
14 |
-
button_deliberate_destruction = gr.Button("Destruction / Deliberatly removed", visible=visible)
|
15 |
|
16 |
with gr.Column(scale=1, min_width="50px"):
|
17 |
img3 = gr.Image(value=PATH + '/assets/logos/indirect.png', show_download_button=False, show_label=False, height="150px")
|
18 |
-
button_indirect_destruction = gr.Button("Indirect destruction", visible=visible)
|
19 |
|
20 |
with gr.Column(scale=1, min_width="50px"):
|
21 |
img4 = gr.Image(value=PATH + '/assets/logos/natural.png', show_download_button=False, show_label=False, height="150px")
|
22 |
-
button_natural_cause = gr.Button("Natural cause", visible=visible)
|
23 |
return image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause
|
24 |
|
25 |
def create_dropdown(visible):
|
26 |
-
print(visible)
|
27 |
with gr.Row() as dropdown_row:
|
28 |
-
dropdown = gr.Dropdown(choices=[],
|
29 |
-
openfield_level2 = gr.Textbox(visible=False)
|
30 |
-
dropdown_level2 = gr.Dropdown(choices=[], visible=False)
|
31 |
-
dropdown_extra_level2 = gr.Dropdown(choices=[], visible=False)
|
32 |
return dropdown_row, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2
|
33 |
|
34 |
|
|
|
7 |
with gr.Row() as image_row:
|
8 |
with gr.Column(scale=1, min_width="50px"):
|
9 |
img1 = gr.Image(value=PATH + '/assets/logos/van.png', show_download_button=False, show_label=False, height="150px")
|
10 |
+
button_collision = gr.Button("Collision with a means of transport", visible=visible, elem_id="buttons-conditions")
|
11 |
|
12 |
with gr.Column(scale=1, min_width="50px"):
|
13 |
img2 = gr.Image(value=PATH + '/assets/logos/destruction.png', show_download_button=False, show_label=False, height="150px")
|
14 |
+
button_deliberate_destruction = gr.Button("Destruction / Deliberatly removed", visible=visible, elem_id="buttons-conditions")
|
15 |
|
16 |
with gr.Column(scale=1, min_width="50px"):
|
17 |
img3 = gr.Image(value=PATH + '/assets/logos/indirect.png', show_download_button=False, show_label=False, height="150px")
|
18 |
+
button_indirect_destruction = gr.Button("Indirect destruction", visible=visible, elem_id="buttons-conditions")
|
19 |
|
20 |
with gr.Column(scale=1, min_width="50px"):
|
21 |
img4 = gr.Image(value=PATH + '/assets/logos/natural.png', show_download_button=False, show_label=False, height="150px")
|
22 |
+
button_natural_cause = gr.Button("Natural cause", visible=visible, elem_id="buttons-conditions")
|
23 |
return image_row, button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause
|
24 |
|
25 |
def create_dropdown(visible):
|
|
|
26 |
with gr.Row() as dropdown_row:
|
27 |
+
dropdown = gr.Dropdown(choices=[], interactive=True, visible=visible, elem_id="dropdown-conditions")
|
28 |
+
openfield_level2 = gr.Textbox(visible=False, elem_id="dropdown-conditions")
|
29 |
+
dropdown_level2 = gr.Dropdown(choices=[], visible=False, elem_id="dropdown-conditions")
|
30 |
+
dropdown_extra_level2 = gr.Dropdown(choices=[], visible=False, elem_id="dropdown-conditions")
|
31 |
return dropdown_row, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2
|
32 |
|
33 |
|
app/wounded.py
CHANGED
@@ -3,7 +3,7 @@ from top_section import create_top_section, create_dropdown
|
|
3 |
|
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 |
|
|
|
3 |
|
4 |
def show_section_wounded(visible):
|
5 |
#with gr.Tab("Wounded Information"):
|
6 |
+
with gr.Column(visible=visible, elem_id="wounded") as wounded_section:
|
7 |
gr.Markdown("# Wounded Animal")
|
8 |
gr.Markdown("Please describe the wound's cause.")
|
9 |
|