Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +24 -0
- best .pt +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from ultralytics import YOLO
|
3 |
+
from PIL import Image
|
4 |
+
import tempfile
|
5 |
+
|
6 |
+
# Cargar el modelo
|
7 |
+
model = YOLO("yolov8_best.pt") # usa la ruta a tu modelo entrenado
|
8 |
+
|
9 |
+
def detect_stomas(image):
|
10 |
+
results = model(image)
|
11 |
+
res_plotted = results[0].plot() # Imagen con predicciones dibujadas
|
12 |
+
return Image.fromarray(res_plotted)
|
13 |
+
|
14 |
+
# Interfaz
|
15 |
+
demo = gr.Interface(
|
16 |
+
fn=detect_stomas,
|
17 |
+
inputs=gr.Image(type="pil"),
|
18 |
+
outputs=gr.Image(type="pil"),
|
19 |
+
title="YOLOv8 - Detecci贸n de Estomas",
|
20 |
+
description="Sube una imagen de una hoja y el modelo detectar谩 estomas usando YOLOv8."
|
21 |
+
)
|
22 |
+
|
23 |
+
if __name__ == "__main__":
|
24 |
+
demo.launch()
|
best .pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43977b1107b51c5c83bd65cbeb1f8f7252b75c34e329c179a20df317e8ace6d9
|
3 |
+
size 52015627
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
ultralytics
|
2 |
+
gradio
|