Spaces:
Runtime error
Runtime error
GiGi2k5 commited on
Commit ·
eea253e
1
Parent(s): d4ca2f3
Add application file
Browse files- .gitattributes +1 -0
- README.md +4 -4
- app.py +45 -0
- requirements.txt +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.keras filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.1.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
-
short_description: App de
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: PomSafe
|
| 3 |
+
emoji: 🐢
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.1.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
short_description: 'App de détecti des maladies des plants de pommiers '
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from PIL import Image
|
| 3 |
+
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))) # Redimensionner l'image
|
| 8 |
+
segmented_img = np.zeros_like(img_array) # Image segmentée fictive (toute noire)
|
| 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 |
+
|
| 14 |
+
# Convertir en image Pillow
|
| 15 |
+
return Image.fromarray(segmented_img)
|
| 16 |
+
|
| 17 |
+
# Simuler un diagnostic fictif
|
| 18 |
+
def analyze_health(segmented_image):
|
| 19 |
+
# Diagnostic fictif
|
| 20 |
+
diagnostic = "La plante semble en bonne santé." # Diagnostic par défaut
|
| 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)
|
| 27 |
+
|
| 28 |
+
return segmented_img, diagnostic
|
| 29 |
+
|
| 30 |
+
# Interface Gradio
|
| 31 |
+
interface = gr.Interface(
|
| 32 |
+
fn=plant_health_analysis,
|
| 33 |
+
inputs=gr.inputs.Image(type="pil", label="Téléchargez une image de plante"),
|
| 34 |
+
outputs=[
|
| 35 |
+
gr.outputs.Image(type="pil", label="Image Segmentée (Fictive)"),
|
| 36 |
+
gr.outputs.Textbox(label="Diagnostic Fictif de la Plante")
|
| 37 |
+
],
|
| 38 |
+
title="PomSafe (Fictif)",
|
| 39 |
+
description="Cette interface simule l'analyse de la santé des plantes. Le modèle de segmentation n'est pas encore intégré.",
|
| 40 |
+
theme="default",
|
| 41 |
+
layout="horizontal"
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
# Lancer l'interface Gradio
|
| 45 |
+
interface.launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==3.40.0
|
| 2 |
+
Pillow==9.4.0
|
| 3 |
+
numpy==1.24.3
|