kisa-misa commited on
Commit
68148c4
·
1 Parent(s): 00d37c7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import tempfile
3
+ import time
4
+ from pathlib import Path
5
+ import cv2
6
+ import gradio as gr
7
+ import torch
8
+ from inferer import Inferer
9
+
10
+ pipeline = Inferer("nateraw/yolov6s", device='cuda')
11
+ print(f"GPU on? {'🟢' if pipeline.device.type != 'cpu' else '🔴'}")
12
+
13
+
14
+ def fn_image(image, conf_thres, iou_thres):
15
+ return pipeline(image, conf_thres, iou_thres)
16
+
17
+
18
+ gr.Interface(
19
+ fn_image,
20
+ inputs=[
21
+ gr.Image(source='webcam', streaming=True),
22
+ gr.Slider(0, 1, value=0.5, label="Confidence Threshold"),
23
+ gr.Slider(0, 1, value=0.5, label="IOU Threshold"),
24
+ ],
25
+ outputs=gr.Image(type="file"),
26
+ live=True,
27
+ title="YOLOv8",
28
+ allow_flagging=False,
29
+ allow_screenshot=False,
30
+ )