kisa-misa commited on
Commit
ce11694
·
1 Parent(s): f5d842b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -22
app.py CHANGED
@@ -1,25 +1,22 @@
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 ultralytics.yolo.v8.detect.predict import predict
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
-
11
-
12
- def fn_image(image):
13
- !python predict.py model=yolov8x6.pt source=image
14
-
15
- gr.Interface(
16
- fn_image,
17
- inputs=[
18
- gr.Image(source='webcam', streaming=True),
19
- ],
20
- outputs=gr.Image(type="pil"),
21
- live=True,
22
- title="YOLOv8",
23
- allow_flagging='never',
24
- #allow_screenshot='never',
25
- )
 
1
+ import tensorflow as tf
 
 
 
2
  import cv2
3
+ import numpy as np
4
+ from glob import glob
5
+ #from models import Yolov4
6
  import gradio as gr
7
+ #model = Yolov4(weight_path="yolov4.weights", class_name_path='coco_classes.txt')
8
+ def gradio_wrapper(img):
9
+ %cd %cd /content/YOLOv8-DeepSORT-Object-Tracking-and-Pulse-Estimation-2/ultralytics/yolo/v8/detect
10
+ !python predict.py model=yolov8x6.pt source=img
11
+ #print(np.shape(img))
12
+ results = model.predict(img)
13
+ return results[0]
14
+ demo = gr.Interface(
15
+ gradio_wrapper,
16
+ #gr.Image(source="webcam", streaming=True, flip=True),
17
+ gr.Image(source="webcam", streaming=True),
18
+ "image",
19
+ live=True
20
+ )
21
 
22
+ demo.launch()