File size: 2,490 Bytes
8b8a06c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a2b8dba
8b8a06c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import gradio as gr
from PIL import Image

def load_image(image):
    return image

def analyze_image(image):
    segmentation_result = image  
    anomaly_detection_result = image  
    disease = "Exemple de maladie de la peau"  
    advice = "Buvez suffisamment d'eau pour maintenir votre peau hydratée de l'intérieur."  
    return segmentation_result, anomaly_detection_result, disease, advice

def clear_analysis():
    return None, None, None, "", ""

def quitter():
    th = print("thanks")
    return th
def aller_vers_scanner():
    return gr.update(visible=False), gr.update(visible=True)

def retour_accueil():
    return gr.update(visible=True), gr.update(visible=False)

with gr.Blocks() as demo:
    
    with gr.Row(visible=True) as page_accueil:
        with gr.Column(elem_id="centered-elements"): 
            gr.Image("logo2.png", height=200) 
            gr.Markdown("<h2 style='text-align:center;'>Bienvenue sur DermScan</h2>")
            gr.Markdown("<h4 style='text-align:center;'>Votre application de confiance pour l'analyse et la santé de votre peau.</h4>")
            with gr.Row():
                btn_quitter = gr.Button("Quitter")
                btn_scanner = gr.Button("Scanner", elem_classes="btn")

    
    with gr.Column(visible=False) as page_scanner:
        with gr.Row() :
            gr.Image("logo2.png", height=200)
        gr.Markdown("<h2>Scanner votre Image</h2>")
        with gr.Row():
            with gr.Column():
                image_input = gr.Image(type="pil", label="Charger Image")
                btn_analyze = gr.Button("Analyser", elem_classes="btn")
            image_output_1 = gr.Image(label="Segmentation", height=343)
            image_output_2 = gr.Image(label="Détection d'anomalie", height=343)
        
        
        text = gr.Textbox(label="Vous souffrez de :", placeholder="Maladie")
        text2 = gr.TextArea(label="Quelques conseils", placeholder="Nos Conseils")
        with gr.Row():
            btn_clear = gr.Button("Effacer")
            btn_retour = gr.Button("Retour")
        

    
    btn_quitter.click(quitter)  
    btn_scanner.click(aller_vers_scanner, None, [page_accueil, page_scanner])
    btn_retour.click(retour_accueil, None, [page_accueil, page_scanner])
    btn_analyze.click(analyze_image, inputs=image_input, outputs=[image_output_1, image_output_2, text, text2])
    btn_clear.click(clear_analysis, None, [image_input, image_output_1, image_output_2, text, text2])




demo.launch()