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