Merge pull request #7 from sdsc-ordes/chore-aesthetics
Browse files- .gitignore +3 -0
- app/dead.py +2 -1
- app/main.py +12 -14
- app/theme.py +17 -0
- app/top_section.py +8 -8
- 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
@@ -2,8 +2,9 @@ import gradio as gr
|
|
2 |
from top_section import create_top_section, create_dropdown
|
3 |
from followup_events import create_followup_section
|
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 |
|
|
|
2 |
from top_section import create_top_section, create_dropdown
|
3 |
from followup_events import create_followup_section
|
4 |
|
5 |
+
|
6 |
def show_section_dead(visible):
|
7 |
+
with gr.Column(visible=visible, elem_id="dead") as section_dead:
|
8 |
gr.Markdown("# Dead Animal")
|
9 |
gr.Markdown("## Please describe the cause of death")
|
10 |
|
app/main.py
CHANGED
@@ -5,24 +5,25 @@ from wounded import show_section_wounded
|
|
5 |
from dropdowns import *
|
6 |
from maps import get_location
|
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("
|
16 |
|
17 |
# ---------------------------------------------------------
|
18 |
# Camera
|
19 |
with gr.Row():
|
20 |
-
with gr.Column(scale=1):
|
21 |
-
|
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")
|
28 |
#display location processing
|
@@ -30,23 +31,20 @@ with gr.Blocks() as demo:
|
|
30 |
label="Identified GPS Location")
|
31 |
with gr.Row():
|
32 |
#to clear it
|
33 |
-
clear_location = gr.ClearButton(components=[location], visible=True, interactive=True,
|
34 |
-
#elem_classes=["custom-button"]
|
35 |
)
|
36 |
clear_location.click()
|
37 |
#to submit it
|
38 |
-
submit_location = gr.Button("
|
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 |
-
|
47 |
-
|
48 |
with gr.Column(scale=1):
|
49 |
-
|
50 |
|
51 |
# ---------------------------------------------------------
|
52 |
# Initiate sections
|
@@ -103,8 +101,8 @@ with gr.Blocks() as demo:
|
|
103 |
# ---------------------------------------------------------
|
104 |
#Submit Button
|
105 |
with gr.Column(scale=1):
|
106 |
-
subbutt = gr.Button("
|
107 |
-
output_message = gr.Markdown("Thank you, you
|
108 |
|
109 |
|
110 |
|
|
|
5 |
from dropdowns import *
|
6 |
from maps import get_location
|
7 |
from style import *
|
8 |
+
from theme import theme, css
|
9 |
|
10 |
+
with gr.Blocks(theme=theme, css=css) as demo:
|
11 |
# ---------------------------------------------------------
|
12 |
# Intro Text
|
13 |
with gr.Row():
|
14 |
with gr.Column(scale=1):
|
15 |
title = gr.Markdown("# Welcome to Digiwild", label="Title")
|
16 |
+
description = gr.Markdown("Please record your wildlife observations here !", label="description")
|
17 |
|
18 |
# ---------------------------------------------------------
|
19 |
# Camera
|
20 |
with gr.Row():
|
21 |
+
#with gr.Column(scale=1):
|
22 |
+
camera = gr.Image(elem_id="image")
|
23 |
|
24 |
# ---------------------------------------------------------
|
25 |
# Location
|
26 |
+
#with gr.Row():
|
27 |
with gr.Column(scale=1):
|
28 |
location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
|
29 |
#display location processing
|
|
|
31 |
label="Identified GPS Location")
|
32 |
with gr.Row():
|
33 |
#to clear it
|
34 |
+
clear_location = gr.ClearButton(components=[location], visible=True, interactive=True, scale=1
|
|
|
35 |
)
|
36 |
clear_location.click()
|
37 |
#to submit it
|
38 |
+
submit_location = gr.Button("Get GPS Coordinates", visible=True, interactive=True, scale=3)
|
39 |
submit_location.click(get_location, inputs=[location], outputs=[identified_location])
|
|
|
40 |
|
41 |
# ---------------------------------------------------------
|
42 |
# Dead and Wounded Buttons
|
43 |
with gr.Row() as block_form:
|
44 |
with gr.Column(scale=1):
|
45 |
+
butt_wounded = gr.Button("Wounded", elem_id="wounded")
|
|
|
46 |
with gr.Column(scale=1):
|
47 |
+
butt_dead = gr.Button("Dead", elem_id="dead")
|
48 |
|
49 |
# ---------------------------------------------------------
|
50 |
# Initiate sections
|
|
|
101 |
# ---------------------------------------------------------
|
102 |
#Submit Button
|
103 |
with gr.Column(scale=1):
|
104 |
+
subbutt = gr.Button("SUBMIT YOUR OBSERVATION TO ORNITHO", elem_id="submit")
|
105 |
+
output_message = gr.Markdown("Thank you, you are a champion of biodiversity conservation !")
|
106 |
|
107 |
|
108 |
|
app/theme.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
css = """
|
4 |
+
.gradio-container {background: url(https://openclipart.org/image/2000px/279687)}
|
5 |
+
#image {background-color: #73b9ae}
|
6 |
+
#dead {background-color: #333333}
|
7 |
+
#wounded {background-color: #5e0724}
|
8 |
+
#buttons-conditions {background-color: #b3b3b3}
|
9 |
+
#dropdown-conditions {background-color: #b3b3b3}
|
10 |
+
#submit {background-color: #91ccb0}
|
11 |
+
"""
|
12 |
+
#wound old: #2d5543
|
13 |
+
#submit:#13422f
|
14 |
+
|
15 |
+
|
16 |
+
theme = gr.themes.Soft(primary_hue="teal", secondary_hue="teal", neutral_hue="emerald",
|
17 |
+
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"])
|
app/top_section.py
CHANGED
@@ -7,27 +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)
|
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 |
with gr.Row() as dropdown_row:
|
27 |
-
dropdown = gr.Dropdown(choices=[],
|
28 |
-
openfield_level2 = gr.Textbox(visible=False)
|
29 |
-
dropdown_level2 = gr.Dropdown(choices=[], visible=False)
|
30 |
-
dropdown_extra_level2 = gr.Dropdown(choices=[], visible=False)
|
31 |
return dropdown_row, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2
|
32 |
|
33 |
|
|
|
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=False, 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 |
from followup_events import create_followup_section
|
4 |
|
5 |
def show_section_wounded(visible):
|
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 |
from followup_events import create_followup_section
|
4 |
|
5 |
def show_section_wounded(visible):
|
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 |
|