feat: icons and color integrated into simplified interface
Browse files- app/dead.py +2 -2
- app/main.py +51 -57
- app/wounded.py +3 -3
app/dead.py
CHANGED
|
@@ -18,7 +18,7 @@ def show_section_dead(visible, individual):
|
|
| 18 |
individual = add_data_to_individual("dead_state", "Yes", individual)
|
| 19 |
|
| 20 |
with gr.Column(visible=visible, elem_id="dead") as section_dead:
|
| 21 |
-
gr.Markdown("
|
| 22 |
gr.Button("Do you know what conditions caused this?",
|
| 23 |
icon=PATH_ICONS + "eye.png",
|
| 24 |
variant= "primary")
|
|
@@ -26,7 +26,7 @@ def show_section_dead(visible, individual):
|
|
| 26 |
radio_cause = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 27 |
button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_circumstances(visible=False)
|
| 28 |
|
| 29 |
-
gr.Button("Are there physical changes on the
|
| 30 |
icon=PATH_ICONS + "cardiogram.png",
|
| 31 |
variant= "primary")
|
| 32 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
|
|
|
| 18 |
individual = add_data_to_individual("dead_state", "Yes", individual)
|
| 19 |
|
| 20 |
with gr.Column(visible=visible, elem_id="dead") as section_dead:
|
| 21 |
+
gr.Markdown("## The animal is dead.")
|
| 22 |
gr.Button("Do you know what conditions caused this?",
|
| 23 |
icon=PATH_ICONS + "eye.png",
|
| 24 |
variant= "primary")
|
|
|
|
| 26 |
radio_cause = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 27 |
button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_circumstances(visible=False)
|
| 28 |
|
| 29 |
+
gr.Button("Are there physical changes on the animal?",
|
| 30 |
icon=PATH_ICONS + "cardiogram.png",
|
| 31 |
variant= "primary")
|
| 32 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
app/main.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
from gradio_modal import Modal
|
| 3 |
|
| 4 |
from validation_submission.utils_individual import add_data_to_individual
|
|
|
|
| 5 |
from validation_submission.validation import reset_error_box
|
| 6 |
from geolocalisation.maps import get_location
|
| 7 |
from functools import partial
|
|
@@ -14,6 +15,7 @@ from physical.physical_checkbox import on_select_body_part, hide_physical
|
|
| 14 |
from behavior.behavior_checkbox import show_behavior, on_select_behavior
|
| 15 |
from follow_up.followup_events import save_fe
|
| 16 |
from styling.style import *
|
|
|
|
| 17 |
|
| 18 |
from geolocalisation.js_geolocation import js_geocode, display_location
|
| 19 |
from validation_submission.utils_individual import generate_random_md5
|
|
@@ -46,17 +48,6 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 46 |
title = gr.Markdown("# Welcome to Digiwild", label="Title")
|
| 47 |
description = gr.Markdown("Please record your wildlife observations here !", label="description")
|
| 48 |
|
| 49 |
-
# ---------------------------------------------------------
|
| 50 |
-
# Intro Text
|
| 51 |
-
with gr.Row():
|
| 52 |
-
gr.Image(PATH_ICONS+"pigeon.png", scale =0.1,
|
| 53 |
-
interactive=False,
|
| 54 |
-
show_fullscreen_button = False, show_share_button=False,
|
| 55 |
-
show_download_button=False, show_label=False)
|
| 56 |
-
with gr.Column(scale=1):
|
| 57 |
-
title = gr.Markdown("# Animal Report", label="Title")
|
| 58 |
-
description = gr.Markdown("Please record your observation here.", label="description")
|
| 59 |
-
|
| 60 |
# ---------------------------------------------------------
|
| 61 |
# Camera
|
| 62 |
with gr.Row():
|
|
@@ -66,50 +57,50 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 66 |
camera = gr.Image(elem_id="image")
|
| 67 |
camera.input(save_image, inputs=[camera, individual], outputs=[individual])
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
|
| 108 |
# ---------------------------------------------------------
|
| 109 |
# Location
|
| 110 |
gr.Button("Location", icon=PATH_ICONS+"pin.png", variant="primary")
|
| 111 |
with gr.Row():
|
| 112 |
-
|
| 113 |
gr.Markdown("#### Location (Using address)")
|
| 114 |
location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
|
| 115 |
#display location processing
|
|
@@ -130,13 +121,14 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 130 |
# Geolocation
|
| 131 |
gr.Markdown("#### Location (Using GPS)")
|
| 132 |
location_data = gr.JSON(label="Identified GPS Location")
|
| 133 |
-
hidden_input = gr.Textbox(visible=False, elem_id="textbox_id")
|
| 134 |
btn_gpslocation = gr.Button("Get Coordinates using GPS (Permission required)")
|
| 135 |
btn_gpslocation.click(None, [], [], js=js_geocode)
|
| 136 |
hidden_input.change(display_location, inputs=hidden_input, outputs=location_data)
|
| 137 |
|
| 138 |
# ---------------------------------------------------------
|
| 139 |
# Dead and Wounded Buttons
|
|
|
|
| 140 |
with gr.Row():
|
| 141 |
gr.Image(PATH_ICONS+"medical-app.png", scale =0.1,
|
| 142 |
interactive=False,
|
|
@@ -146,12 +138,12 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 146 |
gr.Markdown("## The State of the Animal", label="Title")
|
| 147 |
gr.Markdown("Please tell us if the animal was wounded / sick or dead.", label="description")
|
| 148 |
gr.Markdown("Please fill out as many fields as you can, based on what you can see.", label="description")
|
| 149 |
-
gr.Markdown("Do not touch the animal unless absolutely necessary.", label="description")
|
| 150 |
with gr.Row() as block_form:
|
| 151 |
with gr.Column(scale=1):
|
| 152 |
-
butt_wounded = gr.Button("Wounded / Sick", elem_id="wounded")
|
| 153 |
with gr.Column(scale=1):
|
| 154 |
-
butt_dead = gr.Button("Dead", elem_id="dead")
|
| 155 |
|
| 156 |
# ---------------------------------------------------------
|
| 157 |
# Initiate sections
|
|
@@ -363,8 +355,10 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 363 |
# ---------------------------------------------------------
|
| 364 |
# Allow clearing of all previous output
|
| 365 |
with gr.Row():
|
| 366 |
-
button_df = gr.Button("
|
| 367 |
-
|
|
|
|
|
|
|
| 368 |
components=[
|
| 369 |
camera,
|
| 370 |
location, identified_location,
|
|
@@ -387,7 +381,7 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 387 |
fe_name_recipient_wounded, fe_collection_ref_wounded,
|
| 388 |
error_box
|
| 389 |
])
|
| 390 |
-
show_creds = gr.Button("
|
| 391 |
|
| 392 |
# ---------------------------------------------------------
|
| 393 |
# Button Click Logic
|
|
@@ -399,12 +393,12 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 399 |
button_clear.click(reset_error_box, inputs=[error_box], outputs=[error_box])
|
| 400 |
|
| 401 |
|
| 402 |
-
|
|
|
|
| 403 |
button_df.click(validate_save_individual, inputs=[individual, error_box],
|
| 404 |
outputs=[error_box])
|
| 405 |
# ---------------------------------------------------------
|
| 406 |
-
|
| 407 |
-
from credits import credits_text
|
| 408 |
with Modal(visible=False) as modal_creds:
|
| 409 |
gr.Markdown(credits_text)
|
| 410 |
show_creds.click(lambda: Modal(visible=True), None, modal_creds)
|
|
|
|
| 2 |
from gradio_modal import Modal
|
| 3 |
|
| 4 |
from validation_submission.utils_individual import add_data_to_individual
|
| 5 |
+
from validation_submission.submission import validate_save_individual
|
| 6 |
from validation_submission.validation import reset_error_box
|
| 7 |
from geolocalisation.maps import get_location
|
| 8 |
from functools import partial
|
|
|
|
| 15 |
from behavior.behavior_checkbox import show_behavior, on_select_behavior
|
| 16 |
from follow_up.followup_events import save_fe
|
| 17 |
from styling.style import *
|
| 18 |
+
from credits import credits_text
|
| 19 |
|
| 20 |
from geolocalisation.js_geolocation import js_geocode, display_location
|
| 21 |
from validation_submission.utils_individual import generate_random_md5
|
|
|
|
| 48 |
title = gr.Markdown("# Welcome to Digiwild", label="Title")
|
| 49 |
description = gr.Markdown("Please record your wildlife observations here !", label="description")
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
# ---------------------------------------------------------
|
| 52 |
# Camera
|
| 53 |
with gr.Row():
|
|
|
|
| 57 |
camera = gr.Image(elem_id="image")
|
| 58 |
camera.input(save_image, inputs=[camera, individual], outputs=[individual])
|
| 59 |
|
| 60 |
+
# ---------------------------------------------------------
|
| 61 |
+
# General Details
|
| 62 |
+
with gr.Column(scale=1):
|
| 63 |
+
gr.Button("General Details", icon=PATH_ICONS+"bird.png", variant="primary")
|
| 64 |
|
| 65 |
+
with gr.Row():
|
| 66 |
+
specie = gr.Textbox(
|
| 67 |
+
label="Species (if known)",
|
| 68 |
+
placeholder="e.g. European Robin, Common Blackbird",
|
| 69 |
+
info="Enter the species name if you can identify it. If unsure, provide your best guess or general description (e.g. 'small brown bird')",
|
| 70 |
+
visible=True,
|
| 71 |
+
interactive=True
|
| 72 |
+
)
|
| 73 |
|
| 74 |
+
# Number of individuals
|
| 75 |
+
with gr.Row():
|
| 76 |
+
num_individuals = gr.Number(
|
| 77 |
+
label="Number of Individuals",
|
| 78 |
+
value=1, # Default value
|
| 79 |
+
minimum=1,
|
| 80 |
+
precision=0, # Only whole numbers
|
| 81 |
+
info="Enter the number of animals observed",
|
| 82 |
+
#placeholder="Enter number...",
|
| 83 |
+
visible=True,
|
| 84 |
+
interactive=True
|
| 85 |
+
)
|
| 86 |
|
| 87 |
+
# Introducing text_box for comments
|
| 88 |
+
with gr.Row():
|
| 89 |
+
comments = gr.TextArea(
|
| 90 |
+
label="Additional Comments",
|
| 91 |
+
placeholder="Enter any additional observations or notes about the sighting...",
|
| 92 |
+
info="Optional: Add any relevant details about the animal(s) or circumstances",
|
| 93 |
+
lines=3,
|
| 94 |
+
max_lines=5,
|
| 95 |
+
visible=True,
|
| 96 |
+
interactive=True
|
| 97 |
+
)
|
| 98 |
|
| 99 |
# ---------------------------------------------------------
|
| 100 |
# Location
|
| 101 |
gr.Button("Location", icon=PATH_ICONS+"pin.png", variant="primary")
|
| 102 |
with gr.Row():
|
| 103 |
+
with gr.Column(scale=1):
|
| 104 |
gr.Markdown("#### Location (Using address)")
|
| 105 |
location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
|
| 106 |
#display location processing
|
|
|
|
| 121 |
# Geolocation
|
| 122 |
gr.Markdown("#### Location (Using GPS)")
|
| 123 |
location_data = gr.JSON(label="Identified GPS Location")
|
| 124 |
+
hidden_input = gr.Textbox(visible=False, elem_id="textbox_id")
|
| 125 |
btn_gpslocation = gr.Button("Get Coordinates using GPS (Permission required)")
|
| 126 |
btn_gpslocation.click(None, [], [], js=js_geocode)
|
| 127 |
hidden_input.change(display_location, inputs=hidden_input, outputs=location_data)
|
| 128 |
|
| 129 |
# ---------------------------------------------------------
|
| 130 |
# Dead and Wounded Buttons
|
| 131 |
+
gr.Button("State of the Animal", variant="primary")
|
| 132 |
with gr.Row():
|
| 133 |
gr.Image(PATH_ICONS+"medical-app.png", scale =0.1,
|
| 134 |
interactive=False,
|
|
|
|
| 138 |
gr.Markdown("## The State of the Animal", label="Title")
|
| 139 |
gr.Markdown("Please tell us if the animal was wounded / sick or dead.", label="description")
|
| 140 |
gr.Markdown("Please fill out as many fields as you can, based on what you can see.", label="description")
|
| 141 |
+
gr.Markdown("### Do not touch the animal unless absolutely necessary.", label="description")
|
| 142 |
with gr.Row() as block_form:
|
| 143 |
with gr.Column(scale=1):
|
| 144 |
+
butt_wounded = gr.Button("Wounded / Sick", elem_id="wounded", variant="primary")
|
| 145 |
with gr.Column(scale=1):
|
| 146 |
+
butt_dead = gr.Button("Dead", elem_id="dead", variant="primary")
|
| 147 |
|
| 148 |
# ---------------------------------------------------------
|
| 149 |
# Initiate sections
|
|
|
|
| 355 |
# ---------------------------------------------------------
|
| 356 |
# Allow clearing of all previous output
|
| 357 |
with gr.Row():
|
| 358 |
+
button_df = gr.Button("SUBMIT OBSERVATION", icon=PATH_ICONS+"effective.png",
|
| 359 |
+
scale = 3)
|
| 360 |
+
button_clear = gr.ClearButton(value="CLEAR",
|
| 361 |
+
scale = 1,
|
| 362 |
components=[
|
| 363 |
camera,
|
| 364 |
location, identified_location,
|
|
|
|
| 381 |
fe_name_recipient_wounded, fe_collection_ref_wounded,
|
| 382 |
error_box
|
| 383 |
])
|
| 384 |
+
show_creds = gr.Button("CREDITS", icon=PATH_ICONS+"copyright.png", scale=0.5)
|
| 385 |
|
| 386 |
# ---------------------------------------------------------
|
| 387 |
# Button Click Logic
|
|
|
|
| 393 |
button_clear.click(reset_error_box, inputs=[error_box], outputs=[error_box])
|
| 394 |
|
| 395 |
|
| 396 |
+
# ---------------------------------------------------------
|
| 397 |
+
# VALIDATE ANIMAL
|
| 398 |
button_df.click(validate_save_individual, inputs=[individual, error_box],
|
| 399 |
outputs=[error_box])
|
| 400 |
# ---------------------------------------------------------
|
| 401 |
+
#CREDITS
|
|
|
|
| 402 |
with Modal(visible=False) as modal_creds:
|
| 403 |
gr.Markdown(credits_text)
|
| 404 |
show_creds.click(lambda: Modal(visible=True), None, modal_creds)
|
app/wounded.py
CHANGED
|
@@ -19,7 +19,7 @@ def show_section_wounded(visible, individual):
|
|
| 19 |
individual = add_data_to_individual("dead_state", "No", individual)
|
| 20 |
|
| 21 |
with gr.Column(visible=visible, elem_id="wounded") as wounded_section:
|
| 22 |
-
gr.Markdown("
|
| 23 |
|
| 24 |
gr.Button("Do you know what conditions caused this?",
|
| 25 |
icon=PATH_ICONS + "eye.png",
|
|
@@ -27,14 +27,14 @@ def show_section_wounded(visible, individual):
|
|
| 27 |
radio_cause = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 28 |
button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_circumstances(visible=False)
|
| 29 |
|
| 30 |
-
gr.Button("Is the
|
| 31 |
icon=PATH_ICONS + "neuron.png",
|
| 32 |
variant= "primary")
|
| 33 |
radio_behaviour = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 34 |
with gr.Row():
|
| 35 |
behavior_checkbox, behavior_text = create_behavior_checkbox("wounded", False)
|
| 36 |
|
| 37 |
-
gr.Button("Are there physical changes on the
|
| 38 |
icon=PATH_ICONS + "cardiogram.png",
|
| 39 |
variant= "primary")
|
| 40 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
|
|
|
| 19 |
individual = add_data_to_individual("dead_state", "No", individual)
|
| 20 |
|
| 21 |
with gr.Column(visible=visible, elem_id="wounded") as wounded_section:
|
| 22 |
+
gr.Markdown("## The animal is wounded / sick.")
|
| 23 |
|
| 24 |
gr.Button("Do you know what conditions caused this?",
|
| 25 |
icon=PATH_ICONS + "eye.png",
|
|
|
|
| 27 |
radio_cause = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 28 |
button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_circumstances(visible=False)
|
| 29 |
|
| 30 |
+
gr.Button("Is the animal displaying behavioural changes?",
|
| 31 |
icon=PATH_ICONS + "neuron.png",
|
| 32 |
variant= "primary")
|
| 33 |
radio_behaviour = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 34 |
with gr.Row():
|
| 35 |
behavior_checkbox, behavior_text = create_behavior_checkbox("wounded", False)
|
| 36 |
|
| 37 |
+
gr.Button("Are there physical changes on the animal?",
|
| 38 |
icon=PATH_ICONS + "cardiogram.png",
|
| 39 |
variant= "primary")
|
| 40 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|