File size: 2,159 Bytes
facf506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
73
74
#!/usr/bin/env python3
"""
Data2Model Setup Script
Quick installation and setup utility
"""

import os
import sys
import subprocess

def check_python_version():
    """Check if Python version is 3.8 or higher"""
    if sys.version_info < (3, 8):
        print("❌ Python 3.8 or higher is required!")
        print(f"   Current version: {sys.version}")
        sys.exit(1)
    print(f"βœ… Python version: {sys.version.split()[0]}")

def create_directories():
    """Create necessary directories"""
    directories = ['uploads', 'saved_models', 'templates', 'static/css', 'static/js']
    for directory in directories:
        os.makedirs(directory, exist_ok=True)
        print(f"βœ… Created directory: {directory}")

def install_dependencies():
    """Install required Python packages"""
    print("\nπŸ“¦ Installing dependencies...")
    try:
        subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
        print("βœ… Dependencies installed successfully!")
    except subprocess.CalledProcessError:
        print("❌ Failed to install dependencies")
        sys.exit(1)

def create_placeholder_files():
    """Create .gitkeep files to preserve empty directories"""
    for directory in ['uploads', 'saved_models']:
        gitkeep = os.path.join(directory, '.gitkeep')
        with open(gitkeep, 'w') as f:
            f.write('')
        print(f"βœ… Created {gitkeep}")

def main():
    """Main setup function"""
    print("=" * 60)
    print("       Data2Model - Setup Script")
    print("       Automated ML Platform")
    print("=" * 60)
    print()
    
    # Check Python version
    check_python_version()
    
    # Create directories
    print("\nπŸ“ Creating directories...")
    create_directories()
    create_placeholder_files()
    
    # Install dependencies
    install_dependencies()
    
    print("\n" + "=" * 60)
    print("βœ… Setup completed successfully!")
    print("=" * 60)
    print("\nTo start the application:")
    print("  python app.py")
    print("\nThen open your browser and navigate to:")
    print("  http://localhost:5000")
    print()

if __name__ == "__main__":
    main()