Ezra175 commited on
Commit
57261a8
1 Parent(s): 098c01e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ import gradio as gr
4
+
5
+ from ultralytics import YOLO
6
+
7
+ from pickle import TRUE
8
+ def predict(path:str):
9
+ model = YOLO('yolov8s.yaml')
10
+ #aquí se pone el nombre del documento
11
+ model = YOLO('best.pt')
12
+ imagen = cv2.imread(path)
13
+ results = model.predict(source=path)
14
+ for r in results:
15
+ return r.plot()
16
+
17
+ gr.Interface(fn=predict,
18
+ inputs=gr.components.Image(type='filepath', label = 'Input'),
19
+ outputs=gr.components.Image(type='numpy', label='Output')).launch(debug=False)