File size: 2,283 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
Demo script showing how to use the enhanced upload.py with SmoLagent AI
================================================================

This script demonstrates the new AI-powered data analysis capabilities
"""

from upload import EnhancedDataExplorer, load_and_explore_data

def demo_enhanced_features():
    """Demonstrate the enhanced features"""
    print("πŸš€ ENHANCED DATA EXPLORER DEMO")
    print("=" * 50)
    
    # Initialize the enhanced explorer
    explorer = EnhancedDataExplorer()
    
    print("\n1. Loading data...")
    explorer.load_data()
    
    print("\n2. Analyzing data quality...")
    quality_report = explorer.analyze_data_quality()
    
    print("\n3. Creating visualizations...")
    explorer.create_visualizations()
    
    print("\n4. AI Analysis examples (requires model configuration):")
    
    example_queries = [
        "What are the main patterns in this dataset?",
        "Identify any data quality issues",
        "Suggest preprocessing steps",
        "Find correlations between variables",
        "Detect outliers and anomalies"
    ]
    
    for i, query in enumerate(example_queries, 1):
        print(f"   {i}. {query}")
    
    print("\nπŸ’‘ To enable AI analysis:")
    print("   1. Get an API key (OpenAI, Hugging Face, etc.)")
    print("   2. Uncomment the appropriate lines in setup_agent() method")
    print("   3. Run the interactive menu with option 2")

def demo_original_function():
    """Demonstrate the original function (preserved)"""
    print("πŸ“Š ORIGINAL FUNCTION DEMO")
    print("=" * 30)
    
    df = load_and_explore_data()
    print(f"\nβœ… Original function completed. Data shape: {df.shape if df is not None else 'Failed to load'}")

if __name__ == "__main__":
    print("Choose demo mode:")
    print("1. Enhanced features demo")
    print("2. Original function demo")
    print("3. Both")
    
    choice = input("Enter choice (1-3): ").strip()
    
    if choice == "1":
        demo_enhanced_features()
    elif choice == "2":
        demo_original_function()
    elif choice == "3":
        demo_original_function()
        print("\n" + "="*60 + "\n")
        demo_enhanced_features()
    else:
        print("Invalid choice. Running enhanced demo...")
        demo_enhanced_features()