Spaces:
Sleeping
Sleeping
Delete App.py
Browse files
App.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import cv2
|
2 |
-
from ultralytics import YOLO
|
3 |
-
import gradio as gr
|
4 |
-
|
5 |
-
def fonk(img_path):
|
6 |
-
|
7 |
-
model=YOLO("best.pt")
|
8 |
-
|
9 |
-
img= cv2.imread(img_path, cv2.IMREAD_UNCHANGED)
|
10 |
-
|
11 |
-
results= model(img)
|
12 |
-
for result in results:
|
13 |
-
if result.boxes is not None and len(result.boxes):
|
14 |
-
box = result.boxes
|
15 |
-
x1, y1, x2, y2 = map(int, box.xyxy[0])
|
16 |
-
img = cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
17 |
-
return img
|
18 |
-
|
19 |
-
demo = gr.Interface(fonk,
|
20 |
-
inputs= gr.Image(type="filepath"),
|
21 |
-
outputs=gr.Image(),
|
22 |
-
#examples= "images.jpeg"
|
23 |
-
)
|
24 |
-
demo.launch()
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|