Update app.py
Browse files
app.py
CHANGED
@@ -494,10 +494,6 @@ current_image = None
|
|
494 |
current_predictions = None
|
495 |
|
496 |
# ---- Fonctions pour l'UI Gradio ----
|
497 |
-
import pandas as pd
|
498 |
-
import numpy as np
|
499 |
-
import gradio as gr
|
500 |
-
|
501 |
def quick_predict_ui(image_pil):
|
502 |
global current_image, current_predictions
|
503 |
if image_pil is None:
|
@@ -567,7 +563,7 @@ def quick_predict_ui(image_pil):
|
|
567 |
warning_visible = True
|
568 |
|
569 |
# CORRECTION : Créer un DataFrame pandas pour le graphique
|
570 |
-
probabilities = [ensemble_probs[i] * 100 for i in range(len(CLASS_NAMES))]
|
571 |
df_plot = pd.DataFrame({
|
572 |
'Classes': CLASS_NAMES,
|
573 |
'Probabilités (%)': probabilities
|
@@ -593,7 +589,7 @@ def quick_predict_ui(image_pil):
|
|
593 |
None, # Réinitialiser le graphique en cas d'erreur
|
594 |
f"❌ Erreur: {str(e)}"
|
595 |
)
|
596 |
-
|
597 |
def generate_gradcam_ui(progress=gr.Progress()):
|
598 |
global current_image, current_predictions
|
599 |
if current_image is None or current_predictions is None:
|
@@ -708,7 +704,8 @@ with gr.Blocks(theme=theme, title="Analyse de lésions", css=css) as demo:
|
|
708 |
y="Probabilités (%)", # Nom de la colonne y
|
709 |
title="Probabilités par classe",
|
710 |
y_lim=[0, 100],
|
711 |
-
height=450
|
|
|
712 |
)
|
713 |
|
714 |
output_gradcam = gr.Image(label="🔍 Visualisation Grad-CAM")
|
|
|
494 |
current_predictions = None
|
495 |
|
496 |
# ---- Fonctions pour l'UI Gradio ----
|
|
|
|
|
|
|
|
|
497 |
def quick_predict_ui(image_pil):
|
498 |
global current_image, current_predictions
|
499 |
if image_pil is None:
|
|
|
563 |
warning_visible = True
|
564 |
|
565 |
# CORRECTION : Créer un DataFrame pandas pour le graphique
|
566 |
+
probabilities = [round(ensemble_probs[i] * 100, 2) for i in range(len(CLASS_NAMES))]
|
567 |
df_plot = pd.DataFrame({
|
568 |
'Classes': CLASS_NAMES,
|
569 |
'Probabilités (%)': probabilities
|
|
|
589 |
None, # Réinitialiser le graphique en cas d'erreur
|
590 |
f"❌ Erreur: {str(e)}"
|
591 |
)
|
592 |
+
|
593 |
def generate_gradcam_ui(progress=gr.Progress()):
|
594 |
global current_image, current_predictions
|
595 |
if current_image is None or current_predictions is None:
|
|
|
704 |
y="Probabilités (%)", # Nom de la colonne y
|
705 |
title="Probabilités par classe",
|
706 |
y_lim=[0, 100],
|
707 |
+
height=450,
|
708 |
+
show_label=True
|
709 |
)
|
710 |
|
711 |
output_gradcam = gr.Image(label="🔍 Visualisation Grad-CAM")
|