""" 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()