File size: 551 Bytes
da48803
 
 
 
 
 
 
 
586e9f7
da48803
 
 
 
 
586e9f7
da48803
 
586e9f7
cb4bf9a
da48803
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import cv2
import random
import numpy as np
import gradio as gr

from ultralytics import YOLO


def predict(path):
    model = YOLO("yolov8s.yaml")
    model = YOLO("best.pt")
    results = model.predict(source=path)

    for r in results:
        return r.plot(show_conf=True, line_width=None, font_size=None, pil=False)


gr.Interface(title='Generación 16 - Módulo 4',
             fn=predict,
             inputs=gr.components.Image(type="filepath", label="Input"),
             outputs=gr.components.Image(type="numpy", label="Output")).launch()