Download app.py from Fred808/CU1: direct link, hf CLI and curl.
- Browser
- Download file 831 Bytes
-
https://huggingface.co/spaces/Fred808/CU1/resolve/main/app.py
- Command line
-
hf download hf://spaces/Fred808/CU1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Fred808/CU1/resolve/main/app.py
831 Bytes
| import os | |
| import json | |
| from scripts.extract_frames import extract_frames | |
| from scripts.cursor_tracker import track_cursor | |
| def run_pipeline(): | |
| video_dir = "videos" | |
| frames_dir = "frames" | |
| cursor_dir = "cursors" | |
| annotations_dir = "annotations" | |
| os.makedirs(frames_dir, exist_ok=True) | |
| os.makedirs(cursor_dir, exist_ok=True) | |
| os.makedirs(annotations_dir, exist_ok=True) | |
| # Step 1: Extract frames | |
| for video_file in os.listdir(video_dir): | |
| if video_file.lower().endswith(('.mp4', '.avi', '.mov')): | |
| extract_frames(os.path.join(video_dir, video_file), frames_dir) | |
| # Step 2: Track cursor | |
| track_cursor(frames_dir, cursor_dir, os.path.join(annotations_dir, "cursor_positions.json")) | |
| print("Pipeline complete.") | |
| if __name__ == "__main__": | |
| run_pipeline() | |