Spaces:
Runtime error
Runtime error
GiGi2k5 commited on
Commit ·
00341f9
1
Parent(s): dd503b2
changement de gr.inputs et gr.outputs
Browse files
app.py
CHANGED
|
@@ -4,10 +4,9 @@ import numpy as np
|
|
| 4 |
|
| 5 |
# Simuler une segmentation fictive de l'image
|
| 6 |
def segment_image(image):
|
| 7 |
-
img_array = np.array(image.resize((256, 256)))
|
| 8 |
-
segmented_img = np.zeros_like(img_array)
|
| 9 |
|
| 10 |
-
# Si l'image est en niveaux de gris, la convertir en RGB
|
| 11 |
if segmented_img.ndim == 2 or segmented_img.shape[-1] == 1:
|
| 12 |
segmented_img = np.stack([segmented_img] * 3, axis=-1)
|
| 13 |
|
|
@@ -16,11 +15,11 @@ def segment_image(image):
|
|
| 16 |
|
| 17 |
# Simuler un diagnostic fictif
|
| 18 |
def analyze_health(segmented_image):
|
| 19 |
-
|
| 20 |
-
diagnostic = "La plante semble en bonne santé."
|
| 21 |
return diagnostic
|
| 22 |
|
| 23 |
-
# Fonction principale combinant segmentation fictive et diagnostic fictif
|
| 24 |
def plant_health_analysis(image):
|
| 25 |
segmented_img = segment_image(image)
|
| 26 |
diagnostic = analyze_health(segmented_img)
|
|
@@ -30,10 +29,10 @@ def plant_health_analysis(image):
|
|
| 30 |
# Interface Gradio
|
| 31 |
interface = gr.Interface(
|
| 32 |
fn=plant_health_analysis,
|
| 33 |
-
inputs=gr.
|
| 34 |
outputs=[
|
| 35 |
-
gr.
|
| 36 |
-
gr.
|
| 37 |
],
|
| 38 |
title="GreenGenius",
|
| 39 |
description="Cette interface simule l'analyse de la santé des plantes. Le modèle de segmentation n'est pas encore intégré.",
|
|
|
|
| 4 |
|
| 5 |
# Simuler une segmentation fictive de l'image
|
| 6 |
def segment_image(image):
|
| 7 |
+
img_array = np.array(image.resize((256, 256)))
|
| 8 |
+
segmented_img = np.zeros_like(img_array)
|
| 9 |
|
|
|
|
| 10 |
if segmented_img.ndim == 2 or segmented_img.shape[-1] == 1:
|
| 11 |
segmented_img = np.stack([segmented_img] * 3, axis=-1)
|
| 12 |
|
|
|
|
| 15 |
|
| 16 |
# Simuler un diagnostic fictif
|
| 17 |
def analyze_health(segmented_image):
|
| 18 |
+
|
| 19 |
+
diagnostic = "La plante semble en bonne santé."
|
| 20 |
return diagnostic
|
| 21 |
|
| 22 |
+
# Fonction principale combinant la segmentation fictive et le diagnostic fictif
|
| 23 |
def plant_health_analysis(image):
|
| 24 |
segmented_img = segment_image(image)
|
| 25 |
diagnostic = analyze_health(segmented_img)
|
|
|
|
| 29 |
# Interface Gradio
|
| 30 |
interface = gr.Interface(
|
| 31 |
fn=plant_health_analysis,
|
| 32 |
+
inputs=gr.Image(type="pil", label="Téléchargez une image de plante"),
|
| 33 |
outputs=[
|
| 34 |
+
gr.Image(type="pil", label="Image Segmentée (Fictive)"),
|
| 35 |
+
gr.Textbox(label="Diagnostic Fictif de la Plante")
|
| 36 |
],
|
| 37 |
title="GreenGenius",
|
| 38 |
description="Cette interface simule l'analyse de la santé des plantes. Le modèle de segmentation n'est pas encore intégré.",
|