Singtel_Use_Case1 / test_free_ai.py
cosmoruler
problems fixed
c69ba8c
"""
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()