mod4-gen16 / app.py
fernandobarranco's picture
Create app.py
da48803
raw
history blame
551 Bytes
import cv2
import random
import numpy as np
import gradio as gr
from ultralytics import YOLO
def predict(path:str):
model = YOLO("yolov8s.yaml")
model = YOLO("best.pt")
imagen = cv2.imread(path)
results = model.predict(source=path)
for r in results:
return r.plot(show_conf=True, line_width=None, font_size=None, pil=False, example='abc')
gr.Interface(fn=predict,
inputs=gr.components.Image(type="filepath", label="Input"),
outputs=gr.components.Image(type="numpy", label="Output")).launch()