Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -4,8 +4,15 @@ from ultralytics.solutions import ai_gym
|
|
4 |
import cv2
|
5 |
import tempfile
|
6 |
from PIL import Image
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
def process(video_path):
|
|
|
9 |
model = YOLO("yolov8n-pose.pt")
|
10 |
cap = cv2.VideoCapture(video_path)
|
11 |
assert cap.isOpened(), "Error reading video file"
|
|
|
4 |
import cv2
|
5 |
import tempfile
|
6 |
from PIL import Image
|
7 |
+
import subprocess
|
8 |
|
9 |
+
# Function to upgrade pip
|
10 |
+
def upgrade_pip():
|
11 |
+
subprocess.run(['pip', 'install', '--upgrade', 'pip'])
|
12 |
+
|
13 |
+
# Function to process video
|
14 |
def process(video_path):
|
15 |
+
upgrade_pip() # Upgrade pip before executing the main function
|
16 |
model = YOLO("yolov8n-pose.pt")
|
17 |
cap = cv2.VideoCapture(video_path)
|
18 |
assert cap.isOpened(), "Error reading video file"
|