Spaces:
Sleeping
Sleeping
File size: 1,449 Bytes
5e2aaa0 | 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 | #!/usr/bin/env python3
"""
Customer Segmentation App Launcher
=================================
Launch script for the Customer Segmentation Streamlit application.
"""
import subprocess
import sys
import os
def main():
"""Launch the Streamlit application."""
# Change to the project directory
project_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(project_dir)
# Path to the main Streamlit app
app_path = os.path.join("streamlit_app", "main.py")
# Check if the app file exists
if not os.path.exists(app_path):
print(f"โ Error: Streamlit app not found at {app_path}")
sys.exit(1)
print("๐ Launching Customer Segmentation App...")
print(f"๐ Project directory: {project_dir}")
print(f"๐ฏ App path: {app_path}")
print("-" * 50)
try:
# Launch Streamlit
subprocess.run([
sys.executable, "-m", "streamlit", "run", app_path,
"--server.address", "localhost",
"--server.port", "8501",
"--browser.gatherUsageStats", "false"
], check=True)
except subprocess.CalledProcessError as e:
print(f"โ Error launching Streamlit: {e}")
sys.exit(1)
except KeyboardInterrupt:
print("\n๐ Application stopped by user.")
except Exception as e:
print(f"โ Unexpected error: {e}")
sys.exit(1)
if __name__ == "__main__":
main()
|