Spaces:
Sleeping
Sleeping
Download setup.py from Nausad/Data2Model: direct link, hf CLI and curl.
- Browser
- Download file 2.16 kB
-
https://huggingface.co/spaces/Nausad/Data2Model/resolve/main/setup.py
- Command line
-
hf download hf://spaces/Nausad/Data2Model/setup.py
-
curl -L -o setup.py https://huggingface.co/spaces/Nausad/Data2Model/resolve/main/setup.py
2.16 kB
| #!/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() | |