feat: widget reorganization
Browse files- app/main.py +33 -33
app/main.py
CHANGED
@@ -14,7 +14,6 @@ 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 |
-
from styling.theme import css
|
18 |
|
19 |
from geolocalisation.js_geolocation import js_geocode, display_location
|
20 |
from validation_submission.utils_individual import generate_random_md5
|
@@ -25,7 +24,6 @@ disable_caching()
|
|
25 |
dataset_id = "SDSC/digiwild-dataset"
|
26 |
data_files = "data/train-00000-of-00001.parquet"
|
27 |
|
28 |
-
# with gr.Blocks(theme=theme, css=css) as demo:
|
29 |
with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
30 |
individual = gr.State({})
|
31 |
individual.value = add_data_to_individual("image_md5", generate_random_md5(), individual.value)
|
@@ -53,38 +51,10 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
53 |
|
54 |
camera = gr.Image(elem_id="image")
|
55 |
camera.input(save_image, inputs=[camera, individual], outputs=[individual])
|
56 |
-
|
57 |
-
# Location
|
58 |
-
#with gr.Row():
|
59 |
with gr.Column(scale=1):
|
60 |
-
gr.Markdown("### Location")
|
61 |
-
gr.Markdown("#### Location (Using address)")
|
62 |
-
location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
|
63 |
-
#display location processing
|
64 |
-
identified_location= gr.Textbox(visible=False, interactive=False,
|
65 |
-
label="Identified GPS Location")
|
66 |
-
with gr.Row():
|
67 |
-
#to submit it
|
68 |
-
submit_location = gr.Button("Get Coordinates using address",
|
69 |
-
visible=True, interactive=True, scale=3)
|
70 |
-
submit_location.click(get_location, inputs=[location, individual], outputs=[identified_location, individual])
|
71 |
-
#to clear it
|
72 |
-
clear_location = gr.ClearButton(components=[location, identified_location],
|
73 |
-
visible=True, interactive=True, scale=1
|
74 |
-
)
|
75 |
-
clear_location.click()
|
76 |
-
|
77 |
-
# Geolocation
|
78 |
-
gr.Markdown("#### Location (Using GPS)")
|
79 |
-
location_data = gr.JSON(label="Identified GPS Location")
|
80 |
-
hidden_input = gr.Textbox(visible=False, elem_id="textbox_id")
|
81 |
-
btn_gpslocation = gr.Button("Get Coordinates using GPS (Permission required)")
|
82 |
-
btn_gpslocation.click(None, [], [], js=js_geocode)
|
83 |
-
hidden_input.change(display_location, inputs=hidden_input, outputs=location_data)
|
84 |
-
|
85 |
-
|
86 |
-
# Introducing text_box for Species
|
87 |
gr.Markdown("### General details")
|
|
|
88 |
with gr.Row():
|
89 |
specie = gr.Textbox(
|
90 |
label="Species (if known)",
|
@@ -119,9 +89,39 @@ with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
|
119 |
interactive=True
|
120 |
)
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
# ---------------------------------------------------------
|
124 |
-
# ---------------------------------------------------------
|
125 |
# Dead and Wounded Buttons
|
126 |
gr.Markdown("## The State of the Animal", label="Title")
|
127 |
gr.Markdown("Please tell us if the animal was wounded / sick or dead.", label="description")
|
|
|
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
|
|
|
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)
|
|
|
51 |
|
52 |
camera = gr.Image(elem_id="image")
|
53 |
camera.input(save_image, inputs=[camera, individual], outputs=[individual])
|
54 |
+
|
|
|
|
|
55 |
with gr.Column(scale=1):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
gr.Markdown("### General details")
|
57 |
+
|
58 |
with gr.Row():
|
59 |
specie = gr.Textbox(
|
60 |
label="Species (if known)",
|
|
|
89 |
interactive=True
|
90 |
)
|
91 |
|
92 |
+
# ---------------------------------------------------------
|
93 |
+
# Location
|
94 |
+
gr.Markdown("## Location")
|
95 |
+
with gr.Row():
|
96 |
+
with gr.Column(scale=1):
|
97 |
+
gr.Markdown("#### Location (Using address)")
|
98 |
+
location = gr.Textbox(visible=True, interactive=True, label="Location of Sighting")
|
99 |
+
#display location processing
|
100 |
+
identified_location= gr.Textbox(visible=False, interactive=False,
|
101 |
+
label="Identified GPS Location")
|
102 |
+
with gr.Row():
|
103 |
+
#to submit it
|
104 |
+
submit_location = gr.Button("Get Coordinates using address",
|
105 |
+
visible=True, interactive=True, scale=3)
|
106 |
+
submit_location.click(get_location, inputs=[location, individual], outputs=[identified_location, individual])
|
107 |
+
#to clear it
|
108 |
+
clear_location = gr.ClearButton(components=[location, identified_location],
|
109 |
+
visible=True, interactive=True, scale=1
|
110 |
+
)
|
111 |
+
clear_location.click()
|
112 |
+
|
113 |
+
with gr.Column(scale=1):
|
114 |
+
# Geolocation
|
115 |
+
gr.Markdown("#### Location (Using GPS)")
|
116 |
+
location_data = gr.JSON(label="Identified GPS Location")
|
117 |
+
hidden_input = gr.Textbox(visible=False, elem_id="textbox_id")
|
118 |
+
btn_gpslocation = gr.Button("Get Coordinates using GPS (Permission required)")
|
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.Markdown("## The State of the Animal", label="Title")
|
127 |
gr.Markdown("Please tell us if the animal was wounded / sick or dead.", label="description")
|