Miguel commited on
Commit
8b8a06c
·
1 Parent(s): e30f375

Add application file

Browse files
Files changed (2) hide show
  1. app.py +78 -0
  2. logo2.png +0 -0
app.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+
4
+ def load_image(image):
5
+ return image
6
+
7
+ def analyze_image(image):
8
+ segmentation_result = image
9
+ anomaly_detection_result = image
10
+ disease = "Exemple de maladie de la peau"
11
+ advice = "Buvez suffisamment d'eau pour maintenir votre peau hydratée de l'intérieur."
12
+ return segmentation_result, anomaly_detection_result, disease, advice
13
+
14
+ def clear_analysis():
15
+ return None, None, None, "", ""
16
+
17
+ def quitter():
18
+ th = print("thanks")
19
+ return th
20
+ def aller_vers_scanner():
21
+ return gr.update(visible=False), gr.update(visible=True)
22
+
23
+ def retour_accueil():
24
+ return gr.update(visible=True), gr.update(visible=False)
25
+
26
+ with gr.Blocks() as demo:
27
+
28
+ with gr.Row(visible=True) as page_accueil:
29
+ with gr.Column(elem_id="centered-elements"):
30
+ gr.Image("logo2.png", height=200)
31
+ gr.Markdown("<h2 style='text-align:center;'>Bienvenue sur DermScan</h2>")
32
+ gr.Markdown("<h4 style='text-align:center;'>Votre application de confiance pour l'analyse et la santé de votre peau.</h4>")
33
+ with gr.Row():
34
+ btn_quitter = gr.Button("Quitter")
35
+ btn_scanner = gr.Button("Scanner", elem_classes="btn")
36
+
37
+
38
+ with gr.Column(visible=False) as page_scanner:
39
+ with gr.Row() :
40
+ gr.Image("logo2.png", height=200)
41
+ gr.Markdown("<h2>Scanner votre Image</h2>")
42
+ with gr.Row():
43
+ with gr.Column():
44
+ image_input = gr.Image(type="pil", label="Charger Image")
45
+ btn_analyze = gr.Button("Analyser", elem_classes="btn")
46
+ image_output_1 = gr.Image(label="Segmentation", height=343)
47
+ image_output_2 = gr.Image(label="Détection d'anomalie", height=343)
48
+
49
+
50
+ text = gr.Textbox(label="Vous souffrez de :", placeholder="Maladie")
51
+ text2 = gr.TextArea(label="Quelques conseils", placeholder="Nos Conseils")
52
+ with gr.Row():
53
+ btn_clear = gr.Button("Effacer")
54
+ btn_retour = gr.Button("Retour")
55
+
56
+
57
+
58
+ btn_quitter.click(quitter)
59
+ btn_scanner.click(aller_vers_scanner, None, [page_accueil, page_scanner])
60
+ btn_retour.click(retour_accueil, None, [page_accueil, page_scanner])
61
+ btn_analyze.click(analyze_image, inputs=image_input, outputs=[image_output_1, image_output_2, text, text2])
62
+ btn_clear.click(clear_analysis, None, [image_input, image_output_1, image_output_2, text, text2])
63
+
64
+
65
+ demo.css = """
66
+ #centered-elements {
67
+ display: flex;
68
+ flex-direction: column;
69
+ justify-content: center;
70
+ align-items: center;
71
+ height: 100vh;
72
+ }
73
+ .btn {
74
+ background-color: #5E17EB;
75
+ }
76
+ """
77
+
78
+ demo.launch()
logo2.png ADDED