File size: 716 Bytes
68148c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import subprocess
import tempfile
import time
from pathlib import Path
import cv2
import gradio as gr
import torch
from inferer import Inferer

pipeline = Inferer("nateraw/yolov6s", device='cuda')
print(f"GPU on? {'🟢' if pipeline.device.type != 'cpu' else '🔴'}")


def fn_image(image, conf_thres, iou_thres):
    return pipeline(image, conf_thres, iou_thres)


gr.Interface(
    fn_image,
    inputs=[
        gr.Image(source='webcam', streaming=True),
        gr.Slider(0, 1, value=0.5, label="Confidence Threshold"),
        gr.Slider(0, 1, value=0.5, label="IOU Threshold"),
    ],
    outputs=gr.Image(type="file"),
    live=True,
    title="YOLOv8",
    allow_flagging=False,
    allow_screenshot=False,
)