Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import numpy as np
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
from ultralytics import YOLO
|
6 |
+
|
7 |
+
|
8 |
+
def predict(path:str):
|
9 |
+
model = YOLO("yolov8s.yaml")
|
10 |
+
model = YOLO("best-carvana.pt")
|
11 |
+
imagen = cv2.imread(path)
|
12 |
+
results = model.predict(source=path)
|
13 |
+
|
14 |
+
for r in results:
|
15 |
+
return r.plot()
|
16 |
+
|
17 |
+
|
18 |
+
gr.Interface(fn=predict,
|
19 |
+
inputs=gr.components.Image(type="filepath", label="Input"),
|
20 |
+
outputs=gr.components.Image(type="numpy", label="Output")).launch(debug=False)
|