aresad commited on
Commit
56792cd
·
verified ·
1 Parent(s): bc25453

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +23 -0
  2. best.pt +3 -0
  3. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import ultralytics
3
+ from ultralytics import YOLO
4
+ import gradio as gr
5
+ import cv2
6
+
7
+ # Загружаем веса, которые лежат в репозитории
8
+ model = YOLO("best.pt")
9
+
10
+ def detect(image):
11
+ results = model.predict(image, imgsz=640, conf=0.1, verbose=False)
12
+ bgr = results[0].plot()
13
+ rgb = cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB)
14
+ return rgb
15
+
16
+ demo = gr.Interface(
17
+ fn=detect,
18
+ inputs=gr.Image(type="numpy", label="Upload image"),
19
+ outputs=gr.Image(type="numpy", label="Detection result"),
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ demo.launch()
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:334b074e63409834483418f668aed76ca67f939250215a9829cc73d519d5f244
3
+ size 5474259
requirements.txt ADDED
Binary file (3.19 kB). View file