vishnu-coder commited on
Commit
f0ce938
·
1 Parent(s): 8ee8ae9

Added index.py launcher for Streamlit on Vercel

Browse files
Files changed (2) hide show
  1. index.py +7 -0
  2. vercel.json +3 -8
index.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+
4
+ # Run the Streamlit app when deployed on Vercel
5
+ if __name__ == "__main__":
6
+ port = os.environ.get("PORT", "8000")
7
+ subprocess.run(["streamlit", "run", "app.py", "--server.port", port, "--server.address", "0.0.0.0"])
vercel.json CHANGED
@@ -1,14 +1,9 @@
1
  {
2
  "version": 2,
3
  "builds": [
4
- { "src": "app.py", "use": "@vercel/python" }
5
  ],
6
  "routes": [
7
- { "src": "/(.*)", "dest": "app.py" }
8
- ],
9
- "env": {
10
- "STREAMLIT_SERVER_HEADLESS": "true",
11
- "STREAMLIT_SERVER_ENABLECORS": "false",
12
- "STREAMLIT_SERVER_PORT": "8000"
13
- }
14
  }
 
1
  {
2
  "version": 2,
3
  "builds": [
4
+ { "src": "index.py", "use": "@vercel/python" }
5
  ],
6
  "routes": [
7
+ { "src": "/(.*)", "dest": "index.py" }
8
+ ]
 
 
 
 
 
9
  }