-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_local.py
More file actions
73 lines (60 loc) · 1.88 KB
/
Copy pathsetup_local.py
File metadata and controls
73 lines (60 loc) · 1.88 KB
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
#!/usr/bin/env python3
"""
Setup script for running the ML Algorithm Demonstrator locally
"""
import subprocess
import sys
import os
def install_requirements():
"""Install required packages"""
packages = [
"streamlit==1.29.0",
"numpy==1.24.3",
"pandas==2.0.3",
"scikit-learn==1.3.0",
"plotly==5.17.0"
]
print("Installing required packages...")
for package in packages:
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
print(f"✓ Installed {package}")
except subprocess.CalledProcessError:
print(f"✗ Failed to install {package}")
return False
return True
def create_streamlit_config():
"""Create Streamlit configuration"""
config_dir = ".streamlit"
config_file = os.path.join(config_dir, "config.toml")
if not os.path.exists(config_dir):
os.makedirs(config_dir)
config_content = """[server]
headless = true
address = "0.0.0.0"
port = 8501
[theme]
base = "light"
"""
with open(config_file, "w") as f:
f.write(config_content)
print("✓ Created Streamlit configuration")
def main():
print("🤖 Setting up ML Algorithm Demonstrator for local development")
print("=" * 60)
# Install packages
if not install_requirements():
print("❌ Installation failed. Please check your Python environment.")
return
# Create config
create_streamlit_config()
print("\n🎉 Setup complete!")
print("\nTo run the app locally:")
print("1. Open terminal in this directory")
print("2. Run: streamlit run app.py")
print("3. Open browser to: http://localhost:8501")
print("\nFor Vercel deployment:")
print("1. Install Vercel CLI: npm install -g vercel")
print("2. Run: vercel --platform-version 2")
if __name__ == "__main__":
main()