Spaces:
Runtime error
Runtime error
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()
|