-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_video.py
More file actions
56 lines (45 loc) · 1.86 KB
/
debug_video.py
File metadata and controls
56 lines (45 loc) · 1.86 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
"""
Debug script to test video processing
"""
import requests
import os
def test_video_upload():
# Test with a small video file or create a dummy file
print("Testing video upload to backend...")
# Create a dummy video file for testing
dummy_video_path = "test_video.mp4"
# Check if we have any video files in the current directory
video_files = [f for f in os.listdir('.') if f.endswith(('.mp4', '.mov', '.avi'))]
if video_files:
test_file = video_files[0]
print(f"Using existing video file: {test_file}")
else:
print("No video files found. Creating dummy file for testing...")
# Create a minimal dummy file
with open(dummy_video_path, 'wb') as f:
f.write(b'dummy video content')
test_file = dummy_video_path
try:
with open(test_file, 'rb') as f:
files = {'video': (test_file, f, 'video/mp4')}
print("Uploading to backend...")
response = requests.post('http://localhost:5001/analyze', files=files, timeout=30)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.text}")
if response.status_code == 200:
print("✓ Video upload successful!")
result = response.json()
print(f"Overall Score: {result.get('overall_score', 'N/A')}")
else:
print("✗ Video upload failed")
except requests.exceptions.RequestException as e:
print(f"Request error: {e}")
except Exception as e:
print(f"Error: {e}")
finally:
# Clean up dummy file
if test_file == dummy_video_path and os.path.exists(dummy_video_path):
os.remove(dummy_video_path)
if __name__ == "__main__":
test_video_upload()