Merge branch 'main' into feat/hugging-face-dataset
Browse files- app/assets/icons/animal.png +0 -0
- app/assets/icons/bird.png +0 -0
- app/assets/icons/cardiogram.png +0 -0
- app/assets/icons/chicken.png +0 -0
- app/assets/icons/copyright.png +0 -0
- app/assets/icons/effective.png +0 -0
- app/assets/icons/eye.png +0 -0
- app/assets/icons/flying-doves-group.png +0 -0
- app/assets/icons/impact-2.png +0 -0
- app/assets/icons/impact.png +0 -0
- app/assets/icons/medical-app.png +0 -0
- app/assets/icons/neuron.png +0 -0
- app/assets/icons/pigeon.png +0 -0
- app/assets/icons/pin.png +0 -0
- app/assets/icons/schedule.png +0 -0
- app/assets/icons/swallow.png +0 -0
- app/credits.py +52 -0
- app/dead.py +17 -4
- app/main.py +90 -60
- app/wounded.py +19 -4
app/assets/icons/animal.png
ADDED
|
|
app/assets/icons/bird.png
ADDED
|
|
app/assets/icons/cardiogram.png
ADDED
|
|
app/assets/icons/chicken.png
ADDED
|
|
app/assets/icons/copyright.png
ADDED
|
|
app/assets/icons/effective.png
ADDED
|
|
app/assets/icons/eye.png
ADDED
|
|
app/assets/icons/flying-doves-group.png
ADDED
|
|
app/assets/icons/impact-2.png
ADDED
|
|
app/assets/icons/impact.png
ADDED
|
|
app/assets/icons/medical-app.png
ADDED
|
|
app/assets/icons/neuron.png
ADDED
|
|
app/assets/icons/pigeon.png
ADDED
|
|
app/assets/icons/pin.png
ADDED
|
|
app/assets/icons/schedule.png
ADDED
|
|
app/assets/icons/swallow.png
ADDED
|
|
app/credits.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
credits_text = """
|
| 2 |
+
# Credits
|
| 3 |
+
|
| 4 |
+
## Scientific Expertise
|
| 5 |
+
|
| 6 |
+
- Isabelle Wethli (Institute for Fish and Wildlife Health, University of Bern)
|
| 7 |
+
- Dr. Mirjam Pewsner (Institute for Fish and Wildlife Health, University of Bern)
|
| 8 |
+
- Dr. Saskia Keller (Institute for Fish and Wildlife Health, University of Bern)
|
| 9 |
+
|
| 10 |
+
## Front End Development
|
| 11 |
+
|
| 12 |
+
- Carlos Viviar Rios (Swiss Data Science Center)
|
| 13 |
+
- Laure Vancauwenberghe (Swiss Data Science Center)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
### Icons
|
| 23 |
+
|
| 24 |
+
copyright: <a href="https://www.flaticon.com/free-icons/copyright" title="copyright icons">Copyright icons created by Freepik - Flaticon</a>
|
| 25 |
+
|
| 26 |
+
flying-doves-group: <a href="https://www.flaticon.com/free-icons/animal" title="animal icons">Animal icons created by Freepik - Flaticon</a>
|
| 27 |
+
|
| 28 |
+
Pigeon: <a href="https://www.flaticon.com/free-icons/bird" title="bird icons">Bird icons created by Freepik - Flaticon</a>
|
| 29 |
+
|
| 30 |
+
Bird: <a href="https://www.flaticon.com/free-icons/bird" title="bird icons">Bird icons created by PLANBSTUDIO - Flaticon</a>
|
| 31 |
+
|
| 32 |
+
Medical app: <a href="https://www.flaticon.com/free-icons/health" title="health icons">Health icons created by Smashicons - Flaticon</a>
|
| 33 |
+
|
| 34 |
+
Pin: <a href="https://www.flaticon.com/free-icons/google-maps" title="google maps icons">Google maps icons created by Creatype - Flaticon</a>
|
| 35 |
+
|
| 36 |
+
Cardiograms: <a href="https://www.flaticon.com/free-icons/medical" title="medical icons">Medical icons created by Freepik - Flaticon</a>
|
| 37 |
+
|
| 38 |
+
Swallow: <a href="https://www.flaticon.com/free-icons/swallow" title="swallow icons">Swallow icons created by Freepik - Flaticon</a>
|
| 39 |
+
|
| 40 |
+
Chicken: <a href="https://www.flaticon.com/free-icons/chicken" title="chicken icons">Chicken icons created by Freepik - Flaticon</a>
|
| 41 |
+
|
| 42 |
+
eye: <a href="https://www.flaticon.com/free-icons/healthcare-and-medical" title="healthcare and medical icons">Healthcare and medical icons created by juicy_fish - Flaticon</a>
|
| 43 |
+
|
| 44 |
+
neuron: <a href="https://www.flaticon.com/free-icons/neuron" title="neuron icons">Neuron icons created by manshagraphics - Flaticon</a>
|
| 45 |
+
|
| 46 |
+
impact: <a href="https://www.flaticon.com/free-icons/consequence" title="consequence icons">Consequence icons created by Awicon - Flaticon</a>
|
| 47 |
+
|
| 48 |
+
schedule: <a href="https://www.flaticon.com/free-icons/follow-up" title="follow up icons">Follow up icons created by iconsitee - Flaticon</a>
|
| 49 |
+
|
| 50 |
+
Effective: <a href="https://www.flaticon.com/free-icons/cog" title="cog icons">Cog icons created by monkik - Flaticon</a>
|
| 51 |
+
|
| 52 |
+
"""
|
app/dead.py
CHANGED
|
@@ -5,6 +5,13 @@ from physical.physical_checkbox import process_body_parts
|
|
| 5 |
from follow_up.followup_events import create_followup_dropdowns, create_followup_open
|
| 6 |
from validation_submission.utils_individual import add_data_to_individual
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def show_section_dead(visible, individual):
|
| 9 |
if visible==True:
|
| 10 |
individual = add_data_to_individual("wounded_state", "No", individual)
|
|
@@ -12,19 +19,25 @@ def show_section_dead(visible, individual):
|
|
| 12 |
|
| 13 |
with gr.Column(visible=visible, elem_id="dead") as section_dead:
|
| 14 |
gr.Markdown("# Dead Animal")
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
radio_cause = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 18 |
button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_circumstances(visible=False)
|
| 19 |
|
| 20 |
-
gr.
|
|
|
|
|
|
|
| 21 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 22 |
with gr.Row():
|
| 23 |
physical_boxes = create_bird_anatomy(False, "dead")
|
| 24 |
with gr.Column():
|
| 25 |
checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs = process_body_parts("dead", "None")
|
| 26 |
|
| 27 |
-
gr.
|
|
|
|
|
|
|
| 28 |
gr.Markdown("Please tell us what you did with the animal.", label="description")
|
| 29 |
with gr.Row():
|
| 30 |
fe_collection_dropdown, fe_recepient_dropdown, fe_radio_dropdown, fe_answer_dropdown = create_followup_dropdowns(visible, "dead")
|
|
|
|
| 5 |
from follow_up.followup_events import create_followup_dropdowns, create_followup_open
|
| 6 |
from validation_submission.utils_individual import add_data_to_individual
|
| 7 |
|
| 8 |
+
from dotenv import load_dotenv
|
| 9 |
+
import os
|
| 10 |
+
load_dotenv()
|
| 11 |
+
PATH = os.getcwd() + "/"
|
| 12 |
+
PATH_ASSETS = os.getenv('PATH_ASSETS')
|
| 13 |
+
PATH_ICONS = PATH + PATH_ASSETS + "icons/"
|
| 14 |
+
|
| 15 |
def show_section_dead(visible, individual):
|
| 16 |
if visible==True:
|
| 17 |
individual = add_data_to_individual("wounded_state", "No", individual)
|
|
|
|
| 19 |
|
| 20 |
with gr.Column(visible=visible, elem_id="dead") as section_dead:
|
| 21 |
gr.Markdown("# Dead Animal")
|
| 22 |
+
gr.Button("Do you know what conditions caused this?",
|
| 23 |
+
icon=PATH_ICONS + "eye.png",
|
| 24 |
+
variant= "primary")
|
| 25 |
+
# gr.Markdown("## Do you know what conditions caused this?", label="description")
|
| 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 bird?",
|
| 30 |
+
icon=PATH_ICONS + "cardiogram.png",
|
| 31 |
+
variant= "primary")
|
| 32 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 33 |
with gr.Row():
|
| 34 |
physical_boxes = create_bird_anatomy(False, "dead")
|
| 35 |
with gr.Column():
|
| 36 |
checkbox_beak, text_beak, checkbox_body, text_body, checkbox_feathers, text_feathers, checkbox_head, text_head, checkbox_legs, text_legs = process_body_parts("dead", "None")
|
| 37 |
|
| 38 |
+
gr.Button("Follow-Up Events",
|
| 39 |
+
icon=PATH_ICONS + "schedule.png",
|
| 40 |
+
variant= "primary")
|
| 41 |
gr.Markdown("Please tell us what you did with the animal.", label="description")
|
| 42 |
with gr.Row():
|
| 43 |
fe_collection_dropdown, fe_recepient_dropdown, fe_radio_dropdown, fe_answer_dropdown = create_followup_dropdowns(visible, "dead")
|
app/main.py
CHANGED
|
@@ -24,13 +24,24 @@ disable_caching()
|
|
| 24 |
dataset_id = "SDSC/digiwild-dataset"
|
| 25 |
data_files = "data/train-00000-of-00001.parquet"
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
| 28 |
individual = gr.State({})
|
| 29 |
individual.value = add_data_to_individual("image_md5", generate_random_md5(), individual.value)
|
| 30 |
|
| 31 |
# ---------------------------------------------------------
|
| 32 |
-
#
|
| 33 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
with gr.Column(scale=1):
|
| 35 |
title = gr.Markdown("# Welcome to Digiwild", label="Title")
|
| 36 |
description = gr.Markdown("Please record your wildlife observations here !", label="description")
|
|
@@ -38,6 +49,10 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 38 |
# ---------------------------------------------------------
|
| 39 |
# Intro Text
|
| 40 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
with gr.Column(scale=1):
|
| 42 |
title = gr.Markdown("# Animal Report", label="Title")
|
| 43 |
description = gr.Markdown("Please record your observation here.", label="description")
|
|
@@ -48,67 +63,68 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 48 |
def save_image(camera, individual):
|
| 49 |
individual = add_data_to_individual("image", camera.tolist(), individual)
|
| 50 |
return individual
|
| 51 |
-
|
| 52 |
camera = gr.Image(elem_id="image")
|
| 53 |
camera.input(save_image, inputs=[camera, individual], outputs=[individual])
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
specie = gr.Textbox(
|
| 60 |
-
label="Species (if known)",
|
| 61 |
-
placeholder="e.g. European Robin, Common Blackbird",
|
| 62 |
-
info="Enter the species name if you can identify it. If unsure, provide your best guess or general description (e.g. 'small brown bird')",
|
| 63 |
-
visible=True,
|
| 64 |
-
interactive=True
|
| 65 |
-
)
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
#placeholder="Enter number...",
|
| 76 |
-
visible=True,
|
| 77 |
-
interactive=True
|
| 78 |
-
)
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
# ---------------------------------------------------------
|
| 93 |
# Location
|
| 94 |
-
gr.
|
| 95 |
with gr.Row():
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
|
| 113 |
with gr.Column(scale=1):
|
| 114 |
# Geolocation
|
|
@@ -119,12 +135,18 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 119 |
btn_gpslocation.click(None, [], [], js=js_geocode)
|
| 120 |
hidden_input.change(display_location, inputs=hidden_input, outputs=location_data)
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
# ---------------------------------------------------------
|
| 125 |
# Dead and Wounded Buttons
|
| 126 |
-
gr.
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
with gr.Row() as block_form:
|
| 129 |
with gr.Column(scale=1):
|
| 130 |
butt_wounded = gr.Button("Wounded / Sick", elem_id="wounded")
|
|
@@ -365,6 +387,7 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 365 |
fe_name_recipient_wounded, fe_collection_ref_wounded,
|
| 366 |
error_box
|
| 367 |
])
|
|
|
|
| 368 |
|
| 369 |
# ---------------------------------------------------------
|
| 370 |
# Button Click Logic
|
|
@@ -373,13 +396,20 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
| 373 |
outputs=[checkbox_beak_wounded, text_beak_wounded, checkbox_body_wounded, text_body_wounded, checkbox_feathers_wounded, text_feathers_wounded, checkbox_head_wounded, text_head_wounded, checkbox_legs_wounded, text_legs_wounded])
|
| 374 |
button_clear.click(hide_physical,
|
| 375 |
outputs=[checkbox_beak_dead, text_beak_dead, checkbox_body_dead, text_body_dead, checkbox_feathers_dead, text_feathers_dead, checkbox_head_dead, text_head_dead, checkbox_legs_dead, text_legs_dead])
|
|
|
|
| 376 |
|
| 377 |
-
|
| 378 |
-
|
| 379 |
from validation_submission.submission import validate_save_individual
|
| 380 |
button_df.click(validate_save_individual, inputs=[individual, error_box],
|
| 381 |
outputs=[error_box])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
|
|
|
|
| 383 |
|
| 384 |
if __name__ == "__main__":
|
| 385 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 24 |
dataset_id = "SDSC/digiwild-dataset"
|
| 25 |
data_files = "data/train-00000-of-00001.parquet"
|
| 26 |
|
| 27 |
+
from dotenv import load_dotenv
|
| 28 |
+
import os
|
| 29 |
+
load_dotenv()
|
| 30 |
+
PATH = os.getcwd() + "/"
|
| 31 |
+
PATH_ASSETS = os.getenv('PATH_ASSETS')
|
| 32 |
+
PATH_ICONS = PATH + PATH_ASSETS + "icons/"
|
| 33 |
+
|
| 34 |
with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
| 35 |
individual = gr.State({})
|
| 36 |
individual.value = add_data_to_individual("image_md5", generate_random_md5(), individual.value)
|
| 37 |
|
| 38 |
# ---------------------------------------------------------
|
| 39 |
+
# Header Text
|
| 40 |
with gr.Row():
|
| 41 |
+
gr.Image(PATH_ICONS+"swallow.png", scale =0.1,
|
| 42 |
+
interactive=False,
|
| 43 |
+
show_fullscreen_button = False, show_share_button=False,
|
| 44 |
+
show_download_button=False, show_label=False)
|
| 45 |
with gr.Column(scale=1):
|
| 46 |
title = gr.Markdown("# Welcome to Digiwild", label="Title")
|
| 47 |
description = gr.Markdown("Please record your wildlife observations here !", label="description")
|
|
|
|
| 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")
|
|
|
|
| 63 |
def save_image(camera, individual):
|
| 64 |
individual = add_data_to_individual("image", camera.tolist(), individual)
|
| 65 |
return individual
|
|
|
|
| 66 |
camera = gr.Image(elem_id="image")
|
| 67 |
camera.input(save_image, inputs=[camera, individual], outputs=[individual])
|
| 68 |
+
|
| 69 |
+
# ---------------------------------------------------------
|
| 70 |
+
# General Details
|
| 71 |
+
with gr.Column(scale=1):
|
| 72 |
+
gr.Button("General Details", icon=PATH_ICONS+"bird.png", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
with gr.Row():
|
| 75 |
+
specie = gr.Textbox(
|
| 76 |
+
label="Species (if known)",
|
| 77 |
+
placeholder="e.g. European Robin, Common Blackbird",
|
| 78 |
+
info="Enter the species name if you can identify it. If unsure, provide your best guess or general description (e.g. 'small brown bird')",
|
| 79 |
+
visible=True,
|
| 80 |
+
interactive=True
|
| 81 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
# Number of individuals
|
| 84 |
+
with gr.Row():
|
| 85 |
+
num_individuals = gr.Number(
|
| 86 |
+
label="Number of Individuals",
|
| 87 |
+
value=1, # Default value
|
| 88 |
+
minimum=1,
|
| 89 |
+
precision=0, # Only whole numbers
|
| 90 |
+
info="Enter the number of animals observed",
|
| 91 |
+
#placeholder="Enter number...",
|
| 92 |
+
visible=True,
|
| 93 |
+
interactive=True
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# Introducing text_box for comments
|
| 97 |
+
with gr.Row():
|
| 98 |
+
comments = gr.TextArea(
|
| 99 |
+
label="Additional Comments",
|
| 100 |
+
placeholder="Enter any additional observations or notes about the sighting...",
|
| 101 |
+
info="Optional: Add any relevant details about the animal(s) or circumstances",
|
| 102 |
+
lines=3,
|
| 103 |
+
max_lines=5,
|
| 104 |
+
visible=True,
|
| 105 |
+
interactive=True
|
| 106 |
+
)
|
| 107 |
|
| 108 |
# ---------------------------------------------------------
|
| 109 |
# Location
|
| 110 |
+
gr.Button("Location", icon=PATH_ICONS+"pin.png", variant="primary")
|
| 111 |
with gr.Row():
|
| 112 |
+
with gr.Column(scale=1):
|
| 113 |
+
gr.Markdown("#### Location (Using address)")
|
| 114 |
+
location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
|
| 115 |
+
#display location processing
|
| 116 |
+
identified_location= gr.Textbox(visible=False, interactive=False,
|
| 117 |
+
label="Identified GPS Location")
|
| 118 |
+
with gr.Row():
|
| 119 |
+
#to submit it
|
| 120 |
+
submit_location = gr.Button("Get Coordinates using address",
|
| 121 |
+
visible=True, interactive=True, scale=3)
|
| 122 |
+
submit_location.click(get_location, inputs=[location, individual], outputs=[identified_location, individual])
|
| 123 |
+
#to clear it
|
| 124 |
+
clear_location = gr.ClearButton(components=[location, identified_location],
|
| 125 |
+
visible=True, interactive=True, scale=1
|
| 126 |
+
)
|
| 127 |
+
clear_location.click()
|
| 128 |
|
| 129 |
with gr.Column(scale=1):
|
| 130 |
# Geolocation
|
|
|
|
| 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,
|
| 143 |
+
show_fullscreen_button = False, show_share_button=False,
|
| 144 |
+
show_download_button=False, show_label=False)
|
| 145 |
+
with gr.Column():
|
| 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")
|
|
|
|
| 387 |
fe_name_recipient_wounded, fe_collection_ref_wounded,
|
| 388 |
error_box
|
| 389 |
])
|
| 390 |
+
show_creds = gr.Button("Credits", icon=PATH_ICONS+"copyright.png", scale=0.5)
|
| 391 |
|
| 392 |
# ---------------------------------------------------------
|
| 393 |
# Button Click Logic
|
|
|
|
| 396 |
outputs=[checkbox_beak_wounded, text_beak_wounded, checkbox_body_wounded, text_body_wounded, checkbox_feathers_wounded, text_feathers_wounded, checkbox_head_wounded, text_head_wounded, checkbox_legs_wounded, text_legs_wounded])
|
| 397 |
button_clear.click(hide_physical,
|
| 398 |
outputs=[checkbox_beak_dead, text_beak_dead, checkbox_body_dead, text_body_dead, checkbox_feathers_dead, text_feathers_dead, checkbox_head_dead, text_head_dead, checkbox_legs_dead, text_legs_dead])
|
| 399 |
+
button_clear.click(reset_error_box, inputs=[error_box], outputs=[error_box])
|
| 400 |
|
| 401 |
+
|
|
|
|
| 402 |
from validation_submission.submission import validate_save_individual
|
| 403 |
button_df.click(validate_save_individual, inputs=[individual, error_box],
|
| 404 |
outputs=[error_box])
|
| 405 |
+
# ---------------------------------------------------------
|
| 406 |
+
Credits
|
| 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)
|
| 411 |
|
| 412 |
+
|
| 413 |
|
| 414 |
if __name__ == "__main__":
|
| 415 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
app/wounded.py
CHANGED
|
@@ -6,6 +6,13 @@ from behavior.behavior_checkbox import create_behavior_checkbox
|
|
| 6 |
from follow_up.followup_events import create_followup_dropdowns, create_followup_open
|
| 7 |
from validation_submission.utils_individual import add_data_to_individual
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def show_section_wounded(visible, individual):
|
| 10 |
if visible==True:
|
| 11 |
individual = add_data_to_individual("wounded_state", "Yes", individual)
|
|
@@ -14,16 +21,22 @@ def show_section_wounded(visible, individual):
|
|
| 14 |
with gr.Column(visible=visible, elem_id="wounded") as wounded_section:
|
| 15 |
gr.Markdown("# Wounded / Sick Animal")
|
| 16 |
|
| 17 |
-
gr.
|
|
|
|
|
|
|
| 18 |
radio_cause = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 19 |
button_collision, button_deliberate_destruction, button_indirect_destruction, button_natural_cause, dropdown, dropdown_level2, openfield_level2, dropdown_extra_level2 = create_circumstances(visible=False)
|
| 20 |
|
| 21 |
-
gr.
|
|
|
|
|
|
|
| 22 |
radio_behaviour = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 23 |
with gr.Row():
|
| 24 |
behavior_checkbox, behavior_text = create_behavior_checkbox("wounded", False)
|
| 25 |
|
| 26 |
-
gr.
|
|
|
|
|
|
|
| 27 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 28 |
with gr.Row():
|
| 29 |
physical_boxes = create_bird_anatomy(False, "wounded")
|
|
@@ -31,7 +44,9 @@ def show_section_wounded(visible, individual):
|
|
| 31 |
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")
|
| 32 |
|
| 33 |
|
| 34 |
-
gr.
|
|
|
|
|
|
|
| 35 |
gr.Markdown("Please tell us what you did with the animal.", label="description")
|
| 36 |
with gr.Row():
|
| 37 |
fe_collection_dropdown, fe_recepient_dropdown, fe_radio_dropdown, fe_answer_dropdown = create_followup_dropdowns(visible, "wounded")
|
|
|
|
| 6 |
from follow_up.followup_events import create_followup_dropdowns, create_followup_open
|
| 7 |
from validation_submission.utils_individual import add_data_to_individual
|
| 8 |
|
| 9 |
+
from dotenv import load_dotenv
|
| 10 |
+
import os
|
| 11 |
+
load_dotenv()
|
| 12 |
+
PATH = os.getcwd() + "/"
|
| 13 |
+
PATH_ASSETS = os.getenv('PATH_ASSETS')
|
| 14 |
+
PATH_ICONS = PATH + PATH_ASSETS + "icons/"
|
| 15 |
+
|
| 16 |
def show_section_wounded(visible, individual):
|
| 17 |
if visible==True:
|
| 18 |
individual = add_data_to_individual("wounded_state", "Yes", individual)
|
|
|
|
| 21 |
with gr.Column(visible=visible, elem_id="wounded") as wounded_section:
|
| 22 |
gr.Markdown("# Wounded / Sick Animal")
|
| 23 |
|
| 24 |
+
gr.Button("Do you know what conditions caused this?",
|
| 25 |
+
icon=PATH_ICONS + "eye.png",
|
| 26 |
+
variant= "primary")
|
| 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 bird 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 bird?",
|
| 38 |
+
icon=PATH_ICONS + "cardiogram.png",
|
| 39 |
+
variant= "primary")
|
| 40 |
radio_physical = gr.Radio(["Yes", "No"], value=None, show_label=False, interactive=True)
|
| 41 |
with gr.Row():
|
| 42 |
physical_boxes = create_bird_anatomy(False, "wounded")
|
|
|
|
| 44 |
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")
|
| 45 |
|
| 46 |
|
| 47 |
+
gr.Button("Follow-Up Events",
|
| 48 |
+
icon=PATH_ICONS + "schedule.png",
|
| 49 |
+
variant= "primary")
|
| 50 |
gr.Markdown("Please tell us what you did with the animal.", label="description")
|
| 51 |
with gr.Row():
|
| 52 |
fe_collection_dropdown, fe_recepient_dropdown, fe_radio_dropdown, fe_answer_dropdown = create_followup_dropdowns(visible, "wounded")
|