kevanme's picture
Update app.py
94275d8 verified
raw
history blame contribute delete
641 Bytes
import gradio as gr
from ultralytics import YOLO
from PIL import Image
import tempfile
# Cargar el modelo
model = YOLO("best.pt") # usa la ruta a tu modelo entrenado
def detect_stomas(image):
results = model(image)
res_plotted = results[0].plot() # Imagen con predicciones dibujadas
return Image.fromarray(res_plotted)
# Interfaz
demo = gr.Interface(
fn=detect_stomas,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="YOLOv8 - Detección de Estomas",
description="Sube una imagen de una hoja y el modelo detectará estomas usando YOLOv8."
)
if __name__ == "__main__":
demo.launch()