vancauwe commited on
Commit
5608539
·
1 Parent(s): 7b05d65

feat: about and contacts tabs

Browse files
app/{credits.py → about.py} RENAMED
@@ -1,27 +1,46 @@
 
 
 
 
 
 
 
 
 
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
 
@@ -55,4 +74,25 @@ supprimer: <a href="https://www.flaticon.com/fr/icones-gratuites/faux" title="fa
55
 
56
  balai-magique: <a href="https://www.flaticon.com/fr/icones-gratuites/la-magie" title="la magie icônes">La magie icônes créées par Freepik - Flaticon</a>
57
 
58
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from dotenv import load_dotenv
4
+ import os
5
+ load_dotenv()
6
+ PATH = os.getcwd() + "/"
7
+ PATH_ASSETS = os.getenv('PATH_ASSETS')
8
+ PATH_ICONS = PATH + PATH_ASSETS + "icons/"
9
+
10
  credits_text = """
11
  # Credits
12
 
13
+ This work stemmed from a fruitful collaboration between SDSC and FIWI.
 
 
 
 
14
 
15
+ ## Scientific Expertise : FIWI from UniBE
16
 
17
+ From the [Institute for Fish and Wildlife Health, University of Bern](https://www.fiwi.vetsuisse.unibe.ch)
18
+ - **Isabelle Wethli**
19
+ - **Dr. Mirjam Pewsner**
20
+ - **Dr. Saskia Keller**
21
 
22
+ ## Front End Development: SDSC
23
 
24
+ From the [Swiss Data Science Center](https://www.datascience.ch)
25
+ - **Carlos Viviar Rios**
26
+ - **Laure Vancauwenberghe**
27
 
28
+ ## How to Contact Us?
29
 
30
+ Please reach out to FIWI via [their contacts](https://www.fiwi.vetsuisse.unibe.ch/about_us/team/index_eng.html).
31
 
32
+ ## Special Thanks
33
 
34
+ - **Vogelwarte** for their advice, especially Samuel Wechsler.
35
+ - **Biolovision SA**, providers of **ornitho.ch**, for their collaboration: circumstances are matched to their current data collection schema on ornitho.ch
36
 
37
+ """
38
 
39
+ icons_text = """
40
+ ### Icons' Attributions
41
+ (scroll to see all)
42
 
43
+ Biolovision for the circumstances icons.
44
 
45
  flying-doves-group: <a href="https://www.flaticon.com/free-icons/animal" title="animal icons">Animal icons created by Freepik - Flaticon</a>
46
 
 
74
 
75
  balai-magique: <a href="https://www.flaticon.com/fr/icones-gratuites/la-magie" title="la magie icônes">La magie icônes créées par Freepik - Flaticon</a>
76
 
77
+ contact-information: <a href="https://www.flaticon.com/free-icons/contact-information" title="contact information icons">Contact information icons created by Freepik - Flaticon</a>
78
+
79
+ help: <a href="https://www.flaticon.com/free-icons/help" title="help icons">Help icons created by Freepik - Flaticon</a>
80
+
81
+ question: <a href="https://www.flaticon.com/free-icons/question" title="question icons">Question icons created by Freepik - Flaticon</a>
82
+ """
83
+
84
+ with gr.Blocks(theme='shivi/calm_seafoam') as about:
85
+ with gr.Row(scale = 1):
86
+ gr.Image(PATH_ICONS+"sdsc.png",
87
+ height=200,
88
+ interactive=False,
89
+ show_fullscreen_button = False, show_share_button=False,
90
+ show_download_button=False, show_label=False)
91
+ gr.Image(PATH_ICONS+"fiwi.png",
92
+ height=200,
93
+ interactive=False,
94
+ show_fullscreen_button = False, show_share_button=False,
95
+ show_download_button=False, show_label=False)
96
+
97
+ gr.Markdown(credits_text, show_label=False)
98
+ gr.Markdown(icons_text, show_label=False, height=100)
app/assets/icons/contact-information.png ADDED
app/assets/icons/fiwi.png ADDED
app/assets/icons/help.png ADDED
app/assets/icons/question.png ADDED
app/assets/icons/sdsc.png ADDED
app/contacts.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from dotenv import load_dotenv
4
+ import os
5
+ load_dotenv()
6
+ PATH = os.getcwd() + "/"
7
+ PATH_ASSETS = os.getenv('PATH_ASSETS')
8
+ PATH_ICONS = PATH + PATH_ASSETS + "icons/"
9
+
10
+ contact_text = """
11
+ # Contacts
12
+
13
+ You have an animal alive or dead in front of you and you do not know what to do?
14
+ Please call the contact below corresponding to your canton. (Cantons are in alphabetical order.)
15
+
16
+ ## AG: Aargau
17
+ 117 | Departement Bau, Verkehr und Umwelt, Abteilung Wald, Sektion Jagd und Fischerei
18
+
19
+ ## AI: Appenzell Innerrhoden
20
+ 071 788 92 87 | Bau- und Umweltdepartement, Amt für Umwelt, Fachstelle Jagd und Fischerei
21
+
22
+ ## AR: Appenzell Ausserrhoden
23
+ 079 698 19 16 |Departement Bau und Volkswirtschaft, Amt für Raum und Wald, Abteilung Natur und Wildtiere
24
+
25
+ ## BE: Bern
26
+ 0800 940 100 | Wirtschafts-, Energie- und Umweltdirektion
27
+
28
+ ## BL: Basel-Landschaft
29
+ 061 922 03 66, 061 552 56 59 | Volkswirtschafts- und Gesundheitsdirektion, Amt für Wald und Wild beider Basel
30
+
31
+ ## BS: Basel-Stadt
32
+ 061 922 03 66, 061 552 56 59 | Volkswirtschafts- und Gesundheitsdirektion, Amt für Wald und Wild beider Basel
33
+
34
+ ## FR: Fribourg
35
+ 026 305 23 31 | Energie, Landwirtschaft und Umwelt, Amt für Wald und Natur, Sektion Fauna, Jagd und Fischerei
36
+
37
+ ## GE: Geneva
38
+ 022 388 55 00 | Office cantonal de l'agriculture et de la nature, Centrale d'engagement et des transmissions (CET)
39
+
40
+ ## GL: Glarus
41
+ Verwaltung Bau und Umwelt, Umwelt, Wald und Energie, Jagd und Fischerei
42
+
43
+ ## GR: Graubünden
44
+ 055 645 66 66 | Amt für Jagd und Fischerei Jagdbezirke - Über uns
45
+
46
+ ## JU: Jura
47
+ 032 420 48 00, 032 420 65 65 | Departement de l'environnement, Office de l'environnement, Chasse et protection de la faune sauvage
48
+
49
+ ## LU: Luzern
50
+ 041 248 81 17, 117 | Bau-, Umwelt- und Wirtschaftsdepartement, Landwirtschaft und Wald, Jagd, Wildhut und Jagdaufsicht
51
+
52
+ ## NE: Neuchatel
53
+ 032 889 67 80 | Service de la faune, des fôrets et de la nature, faune
54
+
55
+ ## NW: Nidwalden
56
+ 041 618 44 66 | Justiz- und Sicherheitsdirektion, Amt für Justiz, Abteilung Jagd und Fischerei
57
+
58
+ ## OW: Obwalden
59
+ 041 666 64 76 | Bau- und Raumentwicklungsdepartement, Amt für Wald und Landschaft, Wildtiere und Jagd
60
+
61
+ ## SG: St. Gallen
62
+ 117 | Volkwirtschaftsdepartement, Amt für Natur, Jagd und Fischerei
63
+
64
+ ## SH: Schaffhausen
65
+ 052 632 74 66 | Departement des Innern, Jagd und Fischerei
66
+
67
+ ## SO: Solothurn
68
+ 117| Volkswirtschaftdepartement, Amt für Wald, Jagd und Fischerei
69
+
70
+ ## SZ: Schwyz
71
+ 041 819 29 29 | Umweltdepartement, Amt für Wald und Natur, Jagd und Wildtiere
72
+
73
+ ## TG: Thurgau
74
+ 058 345 61 50 | Jagd- und Fischereiverwaltung
75
+
76
+ ## TI: Ticino
77
+ 091 814 28 71 | Divisione dell'ambiente, Ufficio della caccia e della pesca
78
+
79
+ ## UR: Uri
80
+ 041 875 2316 | Sicherheitsdirektion, Amt für Forst und Jagd
81
+
82
+ ## VD: Vaud
83
+ 021 557 88 55 | Environnement, Biodiversité et paysage, Police Faune-nature
84
+
85
+ ## VS: Valais
86
+ 027 606 70 00, 117 | Umwelt, Energie und Landwirtschaft, Dienststelle für Jagd, Fischerei und Wildtiere
87
+
88
+ ## ZG: Zug
89
+ 041 595 41 41 | Natur, Umwelt und Tiere, Arten, Lebensräume, Wildhut und Fischereiaufsicht
90
+
91
+ """
92
+
93
+
94
+ with gr.Blocks(theme='shivi/calm_seafoam') as contacts:
95
+ with gr.Row(scale = 1):
96
+ gr.Image(PATH_ICONS+"help.png", height=300,
97
+ interactive=False,
98
+ show_fullscreen_button = False, show_share_button=False,
99
+ show_download_button=False, show_label=False)
100
+ gr.Image(PATH_ICONS+"contact-information.png", height=300,
101
+ interactive=False,
102
+ show_fullscreen_button = False, show_share_button=False,
103
+ show_download_button=False, show_label=False)
104
+ gr.Image(PATH_ICONS+"question.png", height=300,
105
+ interactive=False,
106
+ show_fullscreen_button = False, show_share_button=False,
107
+ show_download_button=False, show_label=False)
108
+
109
+ gr.Markdown(contact_text, show_label=False)
110
+
app/{dead.py → dead_wounded/dead.py} RENAMED
File without changes
app/{wounded.py → dead_wounded/wounded.py} RENAMED
File without changes
app/gradio_test/test_selectdata_event.py DELETED
@@ -1,16 +0,0 @@
1
- import gradio as gr
2
-
3
- with gr.Blocks() as demo:
4
- table = gr.Dataframe([[1, 2, 3], [4, 5, 6]])
5
- #gallery = gr.Gallery([("cat.jpg", "Cat"), ("dog.jpg", "Dog")])
6
- textbox = gr.Textbox("Hello World!")
7
- statement = gr.Textbox()
8
-
9
- def on_select(evt: gr.SelectData):
10
- return gr.Textbox(f"You selected {evt.value} at {evt.index} from {evt.target}")
11
-
12
- table.select(on_select, inputs=[table], outputs=[statement])
13
- #gallery.select(on_select, gallery, statement)
14
- textbox.select(on_select, inputs=[textbox], outputs=[statement])
15
-
16
- demo.launch(server_name="0.0.0.0", server_port=3131)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/gradio_test/tests_delete_gallery.py DELETED
@@ -1,25 +0,0 @@
1
- import gradio as gr
2
-
3
- # Example initial image list
4
- images = [
5
- "https://via.placeholder.com/150/0000FF",
6
- "https://via.placeholder.com/150/FF0000",
7
- "https://via.placeholder.com/150/00FF00"
8
- ]
9
-
10
- # Function to remove a selected image from the gallery
11
- def delete_image(selected_image, image_list):
12
- if selected_image in image_list:
13
- image_list.remove(selected_image) # Remove the selected image
14
- return image_list # Return the updated image list
15
-
16
- # Gradio app
17
- with gr.Blocks() as demo:
18
- gallery = gr.Gallery(value=images, label="Gallery") # Gallery of images
19
- selected_image = gr.Dropdown(choices=images, label="Select Image to Delete") # Dropdown for selection
20
- delete_button = gr.Button("Delete Selected Image") # Button to delete
21
-
22
- # When button is clicked, delete the selected image and update gallery
23
- delete_button.click(fn=delete_image, inputs=[selected_image, gallery], outputs=gallery)
24
-
25
- demo.launch(server_name="0.0.0.0", server_port=3232)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main.py CHANGED
@@ -5,8 +5,12 @@ disable_caching()
5
 
6
  from mode_advanced import advanced
7
  from mode_simple import simple
 
 
8
 
9
- demo = gr.TabbedInterface([simple, advanced], ["Simple Mode" , "Advanced Reporting"],
 
 
10
  theme='shivi/calm_seafoam')
11
 
12
  if __name__ == "__main__":
 
5
 
6
  from mode_advanced import advanced
7
  from mode_simple import simple
8
+ from contacts import contacts
9
+ from about import about
10
 
11
+
12
+ demo = gr.TabbedInterface([simple, advanced, contacts, about],
13
+ ["Simple Mode" , "Advanced Reporting", "Cantonal Contacts", "About"],
14
  theme='shivi/calm_seafoam')
15
 
16
  if __name__ == "__main__":
app/mode_advanced.py CHANGED
@@ -1,24 +1,23 @@
1
  import gradio as gr
2
  from gradio_modal import Modal
 
3
 
4
  from geolocalisation.js_geolocation import js_geocode, display_location
5
- from validation_submission.utils_individual import generate_random_md5
6
- from validation_submission.utils_individual import add_data_to_individual
7
- from validation_submission.submission import validate_save_individual
8
- from validation_submission.validation import reset_error_box
9
- from validation_submission.utils_individual import reset_individual
10
  from geolocalisation.maps import get_location
11
- from functools import partial
12
- from dead import show_section_dead
13
- from wounded import show_section_wounded
14
  from circumstances.circumstances import show_circumstances
15
  from circumstances.circumstances_dropdowns import *
16
  from physical.physical_select_animal import show_physical, find_bounding_box
17
  from physical.physical_checkbox import on_select_body_part, hide_physical
18
  from behavior.behavior_checkbox import show_behavior, on_select_behavior
19
  from follow_up.followup_events import save_fe
 
 
 
 
 
20
  from styling.style import *
21
- from credits import credits_text
22
 
23
  from dotenv import load_dotenv
24
  import os
@@ -407,10 +406,18 @@ with gr.Blocks(theme='shivi/calm_seafoam') as advanced:
407
  fe_name_recipient_wounded, fe_collection_ref_wounded,
408
  error_icon, error_box
409
  ])
410
- show_creds = gr.Button("CREDITS", icon=PATH_ICONS+"copyright.png", scale=0.5)
411
-
412
  # ---------------------------------------------------------
413
- # Button Click Logic
 
 
 
 
 
 
 
 
 
414
  button_clear.click()
415
  button_clear.click(hide_physical,
416
  inputs =[gr.Text(mode, visible=False)],
@@ -428,17 +435,4 @@ with gr.Blocks(theme='shivi/calm_seafoam') as advanced:
428
  checkbox_legs_dead, text_legs_dead])
429
  button_clear.click(reset_error_box, inputs=[error_icon, error_box], outputs=[error_icon, error_box])
430
  button_clear.click(reset_individual, inputs=[individual], outputs=[individual])
431
-
432
- # ---------------------------------------------------------
433
- # VALIDATE ANIMAL
434
- button_df.click(validate_save_individual,
435
- inputs=[individual,
436
- error_icon,
437
- error_box,
438
- gr.Text(mode, visible=False)],
439
- outputs=[individual, error_icon, error_box])
440
- # ---------------------------------------------------------
441
- #CREDITS
442
- with Modal(visible=False) as modal_creds:
443
- gr.Markdown(credits_text)
444
- show_creds.click(lambda: Modal(visible=True), None, modal_creds)
 
1
  import gradio as gr
2
  from gradio_modal import Modal
3
+ from functools import partial
4
 
5
  from geolocalisation.js_geolocation import js_geocode, display_location
 
 
 
 
 
6
  from geolocalisation.maps import get_location
7
+ from dead_wounded.dead import show_section_dead
8
+ from dead_wounded.wounded import show_section_wounded
 
9
  from circumstances.circumstances import show_circumstances
10
  from circumstances.circumstances_dropdowns import *
11
  from physical.physical_select_animal import show_physical, find_bounding_box
12
  from physical.physical_checkbox import on_select_body_part, hide_physical
13
  from behavior.behavior_checkbox import show_behavior, on_select_behavior
14
  from follow_up.followup_events import save_fe
15
+ from validation_submission.utils_individual import generate_random_md5
16
+ from validation_submission.utils_individual import add_data_to_individual
17
+ from validation_submission.submission import validate_save_individual
18
+ from validation_submission.validation import reset_error_box
19
+ from validation_submission.utils_individual import reset_individual
20
  from styling.style import *
 
21
 
22
  from dotenv import load_dotenv
23
  import os
 
406
  fe_name_recipient_wounded, fe_collection_ref_wounded,
407
  error_icon, error_box
408
  ])
409
+
 
410
  # ---------------------------------------------------------
411
+ # VALIDATE ANIMAL
412
+ button_df.click(validate_save_individual,
413
+ inputs=[individual,
414
+ error_icon,
415
+ error_box,
416
+ gr.Text(mode, visible=False)],
417
+ outputs=[error_icon, error_box])
418
+
419
+ # ---------------------------------------------------------
420
+ # CLEAR BUTTON
421
  button_clear.click()
422
  button_clear.click(hide_physical,
423
  inputs =[gr.Text(mode, visible=False)],
 
435
  checkbox_legs_dead, text_legs_dead])
436
  button_clear.click(reset_error_box, inputs=[error_icon, error_box], outputs=[error_icon, error_box])
437
  button_clear.click(reset_individual, inputs=[individual], outputs=[individual])
438
+
 
 
 
 
 
 
 
 
 
 
 
 
 
app/mode_simple.py CHANGED
@@ -2,13 +2,9 @@ import gradio as gr
2
  from gradio_modal import Modal
3
  from functools import partial
4
 
5
- from validation_submission.utils_individual import add_data_to_individual
6
- from validation_submission.submission import validate_save_individual
7
- from validation_submission.validation import reset_error_box
8
-
9
-
10
- from dead import show_section_dead
11
- from wounded import show_section_wounded
12
  from circumstances.circumstances import show_circumstances
13
  from circumstances.circumstances_dropdowns import *
14
  from physical.physical_select_animal import show_physical, find_bounding_box
@@ -16,10 +12,10 @@ from physical.physical_checkbox import on_select_body_part, hide_physical
16
  from behavior.behavior_checkbox import show_behavior, on_select_behavior
17
  from follow_up.followup_events import save_fe
18
  from styling.style import *
19
- from credits import credits_text
20
  from validation_submission.utils_individual import reset_individual
21
-
22
- from geolocalisation.js_geolocation import js_geocode, display_location
 
23
  from validation_submission.utils_individual import generate_random_md5
24
 
25
  from dotenv import load_dotenv
@@ -384,8 +380,8 @@ with gr.Blocks(theme='shivi/calm_seafoam') as simple:
384
  with gr.Row():
385
  button_df = gr.Button("SUBMIT OBSERVATION", icon=PATH_ICONS+"effective.png",
386
  scale = 3)
387
- button_clear = gr.ClearButton(value="CLEAR",
388
- scale = 1,
389
  icon = PATH_ICONS+"balai-magique.png",
390
  components=[
391
  camera,
@@ -408,10 +404,18 @@ with gr.Blocks(theme='shivi/calm_seafoam') as simple:
408
  fe_name_recipient_wounded, fe_collection_ref_wounded,
409
  error_icon, error_box
410
  ])
411
- show_creds = gr.Button("CREDITS", icon=PATH_ICONS+"copyright.png", scale=0.5)
412
-
413
  # ---------------------------------------------------------
414
- # Button Click Logic
 
 
 
 
 
 
 
 
 
415
  button_clear.click()
416
  button_clear.click(hide_physical,
417
  inputs=[gr.Text(mode, visible=False)],
@@ -430,16 +434,4 @@ with gr.Blocks(theme='shivi/calm_seafoam') as simple:
430
  button_clear.click(reset_error_box, inputs=[error_icon, error_box], outputs=[error_icon, error_box])
431
  button_clear.click(reset_individual, inputs=[individual], outputs=[individual])
432
 
433
- # ---------------------------------------------------------
434
- # VALIDATE ANIMAL
435
- button_df.click(validate_save_individual,
436
- inputs=[individual,
437
- error_icon,
438
- error_box,
439
- gr.Text(mode, visible=False)],
440
- outputs=[error_icon, error_box])
441
- # ---------------------------------------------------------
442
- #CREDITS
443
- with Modal(visible=False) as modal_creds:
444
- gr.Markdown(credits_text)
445
- show_creds.click(lambda: Modal(visible=True), None, modal_creds)
 
2
  from gradio_modal import Modal
3
  from functools import partial
4
 
5
+ from geolocalisation.js_geolocation import js_geocode, display_location
6
+ from dead_wounded.dead import show_section_dead
7
+ from dead_wounded.wounded import show_section_wounded
 
 
 
 
8
  from circumstances.circumstances import show_circumstances
9
  from circumstances.circumstances_dropdowns import *
10
  from physical.physical_select_animal import show_physical, find_bounding_box
 
12
  from behavior.behavior_checkbox import show_behavior, on_select_behavior
13
  from follow_up.followup_events import save_fe
14
  from styling.style import *
 
15
  from validation_submission.utils_individual import reset_individual
16
+ from validation_submission.utils_individual import add_data_to_individual
17
+ from validation_submission.submission import validate_save_individual
18
+ from validation_submission.validation import reset_error_box
19
  from validation_submission.utils_individual import generate_random_md5
20
 
21
  from dotenv import load_dotenv
 
380
  with gr.Row():
381
  button_df = gr.Button("SUBMIT OBSERVATION", icon=PATH_ICONS+"effective.png",
382
  scale = 3)
383
+ button_clear = gr.ClearButton(value="CLEAR / Create NEW Observation",
384
+ scale = 2,
385
  icon = PATH_ICONS+"balai-magique.png",
386
  components=[
387
  camera,
 
404
  fe_name_recipient_wounded, fe_collection_ref_wounded,
405
  error_icon, error_box
406
  ])
407
+
 
408
  # ---------------------------------------------------------
409
+ # VALIDATE & SUBMIT ANIMAL
410
+ button_df.click(validate_save_individual,
411
+ inputs=[individual,
412
+ error_icon,
413
+ error_box,
414
+ gr.Text(mode, visible=False)],
415
+ outputs=[error_icon, error_box])
416
+
417
+ # ---------------------------------------------------------
418
+ # CLEAR BUTTON
419
  button_clear.click()
420
  button_clear.click(hide_physical,
421
  inputs=[gr.Text(mode, visible=False)],
 
434
  button_clear.click(reset_error_box, inputs=[error_icon, error_box], outputs=[error_icon, error_box])
435
  button_clear.click(reset_individual, inputs=[individual], outputs=[individual])
436
 
437
+