trannam1084 commited on
Commit
623838a
·
verified ·
1 Parent(s): 1e2f3c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -6,7 +6,7 @@ import gradio as gr
6
  import supervision as sv
7
  from ultralytics import YOLO
8
 
9
- model = YOLO("yolo11n.pt")
10
  CLASS_NAMES_DICT = model.model.names
11
 
12
  SELECTED_CLASS_NAMES = ['car', 'bus', 'truck', 'motorcycle']
@@ -35,7 +35,8 @@ def process_video(video_path, orientation="Horizontal"):
35
  video_info = sv.VideoInfo.from_video_path(video_path)
36
  w, h = video_info.width, video_info.height
37
 
38
- is_horizontal = orientation.lower().startswith("n")
 
39
  if is_horizontal:
40
  line_pos = int(h * 0.5)
41
  line_start = sv.Point(int(w * 0.005), line_pos)
 
6
  import supervision as sv
7
  from ultralytics import YOLO
8
 
9
+ model = YOLO("yolov8n.pt")
10
  CLASS_NAMES_DICT = model.model.names
11
 
12
  SELECTED_CLASS_NAMES = ['car', 'bus', 'truck', 'motorcycle']
 
35
  video_info = sv.VideoInfo.from_video_path(video_path)
36
  w, h = video_info.width, video_info.height
37
 
38
+ ori = str(orientation).strip().lower()
39
+ is_horizontal = ori.startswith("n") or ori.startswith("h")
40
  if is_horizontal:
41
  line_pos = int(h * 0.5)
42
  line_start = sv.Point(int(w * 0.005), line_pos)