-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_enhanced_recommendations.py
More file actions
58 lines (51 loc) Β· 2.39 KB
/
test_enhanced_recommendations.py
File metadata and controls
58 lines (51 loc) Β· 2.39 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
57
58
import requests
import json
import traceback
# Test the enhanced recommendations API
url = "http://127.0.0.1:8002/api/recommendations/generate"
data = {
"filename": "travel_vlog_example.mp4",
"metadata": {
"duration": 150,
"width": 1920,
"height": 1080,
"size": 75000000
}
}
print("π Testing enhanced AI recommendations...")
print(f"URL: {url}")
print(f"Data: {json.dumps(data, indent=2)}")
try:
print("π Making request...")
response = requests.post(url, json=data, timeout=30)
print(f"β
Response received! Status: {response.status_code}")
if response.headers.get('content-type', '').startswith('application/json'):
result = response.json()
print(f"\nπ Success: {result.get('success', False)}")
if result.get('success'):
recs = result['recommendations']
print(f"π Overall Score: {recs.get('overall_score', 'N/A')}")
print(f"π Sentiment: {recs.get('sentiment', 'N/A')}")
print(f"π Cuts: {len(recs['editing_recommendations'].get('cuts', []))}")
print(f"π Music: {len(recs['editing_recommendations'].get('music', []))}")
print(f"π Filters: {len(recs['editing_recommendations'].get('filters', []))}")
print(f"π Quality Improvements: {len(recs.get('quality_improvements', []))}")
print(f"π Engagement Tips: {len(recs.get('engagement_tips', []))}")
print(f"π Platform Optimizations: {len(recs.get('platform_optimization', {}))}")
# Show a sample cut recommendation
if recs['editing_recommendations'].get('cuts'):
cut = recs['editing_recommendations']['cuts'][0]
print(f"\n㪠Sample Cut Recommendation:")
print(f" Type: {cut.get('type')}")
print(f" Reason: {cut.get('reason')}")
print(f" Impact: {cut.get('expected_impact', 'N/A')}")
print(f" Priority: {cut.get('priority')}")
else:
print(f"β Error in response: {result.get('error', 'Unknown error')}")
else:
print(f"\nπ Non-JSON Response: {response.text[:500]}")
except requests.exceptions.RequestException as e:
print(f"β Request Error: {e}")
except Exception as e:
print(f"β Other Error: {e}")
print(f"β Traceback: {traceback.format_exc()}")