AdarshJi commited on
Commit
a465e29
·
verified ·
1 Parent(s): 5cb2bb5

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +21 -0
start.sh ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Default env values (can be overridden in HF Space settings)
5
+ PORT="${PORT:-7860}"
6
+ NO_INITIAL_FETCH="${NO_INITIAL_FETCH:-true}"
7
+ ZD_HEADLESS="${ZD_HEADLESS:-true}"
8
+
9
+ # Export these so the Python app sees them
10
+ export NO_INITIAL_FETCH
11
+ export ZD_HEADLESS
12
+
13
+ echo "Starting Perchance server with:"
14
+ echo " PORT=$PORT"
15
+ echo " NO_INITIAL_FETCH=$NO_INITIAL_FETCH"
16
+ echo " ZD_HEADLESS=$ZD_HEADLESS"
17
+ echo " CHROME_BIN=${CHROME_BIN:-/usr/bin/chromium}"
18
+
19
+ # Start uvicorn pointing at your module (perchance_server.py -> app)
20
+ # Use 1 worker in Spaces; adjust if you understand the environment.
21
+ exec uvicorn perchance_server:app --host 0.0.0.0 --port "${PORT}" --workers 1 --log-level info