File size: 2,271 Bytes
37cadfb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
"""
Final test for mocked YouTube video analysis with GAIA solver
"""

import os
import sys
import gaia_tools
from main import GAIASolver
from question_classifier import QuestionClassifier

# Original function reference
original_analyze_youtube_video = gaia_tools.analyze_youtube_video

# Mock implementation
def mock_analyze_youtube_video(video_url, question, max_frames=10):
    """Mock YouTube video analysis that returns predetermined response"""
    print(f"🎬 Mock analyzing video: {video_url}")
    
    return """
Video Analysis Results:
Video Title: Bird Identification Challenge: Backyard Birds in Spring
Duration: 3:42

Analysis:
After careful frame-by-frame analysis of the video, the highest number of different bird species visible simultaneously is 3. 
This occurs at approximately 1:23 into the video, where we can see:
1. American Robin
2. Northern Cardinal
3. Blue Jay

These three species are clearly visible in the same frame at this timestamp.
"""

def main():
    """Run test with mocked YouTube analysis"""
    # Set up mock
    print("πŸ”„ Setting up mock YouTube analysis...")
    gaia_tools.analyze_youtube_video = mock_analyze_youtube_video
    
    try:
        # Create GAIA solver
        print("🧠 Creating GAIA solver...")
        solver = GAIASolver()
        
        # Create test question
        question = {
            'task_id': 'test-youtube-123',
            'Question': 'In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?'
        }
        
        # Process question
        print("🧩 Processing question...")
        result = solver.solve_question(question)
        
        # Display result
        print("\nπŸ“‹ Result:")
        print(result)
        
        # Validate
        if '3' in str(result):
            print("βœ… Validation: CORRECT - Found expected answer '3'")
        else:
            print("❌ Validation: FAILED - Expected '3' but got different answer")
            
    finally:
        # Restore original function
        print("\nπŸ”„ Restoring original YouTube analysis...")
        gaia_tools.analyze_youtube_video = original_analyze_youtube_video

if __name__ == "__main__":
    main()