File size: 1,796 Bytes
c69ba8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Simple Free AI Test
==================

Test the free AI models in your upload.py script
"""

def test_free_models():
    """Test free AI models availability"""
    print("πŸ” Testing free AI models...")
    
    try:
        from upload import EnhancedDataExplorer
        
        print("πŸ“Š Creating data explorer...")
        explorer = EnhancedDataExplorer()
        
        if explorer.agent is not None:
            print("βœ… Free AI model configured successfully!")
            print("πŸŽ‰ You can now use AI-powered data analysis!")
            
            # Test with a simple query
            print("\nπŸ§ͺ Testing AI with a simple query...")
            test_query = "Hello, can you help with data analysis?"
            
            # Simulate having some data
            import pandas as pd
            import numpy as np
            test_data = pd.DataFrame({
                'A': np.random.randn(100),
                'B': np.random.randn(100),
                'C': ['category1', 'category2'] * 50
            })
            explorer.df = test_data
            
            # Test AI analysis
            try:
                response = explorer.ai_analysis("Describe this test dataset briefly")
                if response:
                    print("βœ… AI analysis test successful!")
                else:
                    print("⚠️  AI analysis returned no response")
            except Exception as e:
                print(f"⚠️  AI analysis test failed: {e}")
                
        else:
            print("❌ No free AI models available.")
            print("πŸ’‘ Try running: python setup_free_ai.py")
            
    except Exception as e:
        print(f"❌ Error testing free models: {e}")

if __name__ == "__main__":
    test_free_models()