Spaces:
Sleeping
Sleeping
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
set -euo pipefail
|
| 3 |
|
| 4 |
-
#
|
| 5 |
mkdir -p /tmp
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# set -euo pipefail
|
| 3 |
+
|
| 4 |
+
# # ensure checkpoint directory exists; model will auto-download in app init if missing
|
| 5 |
+
# mkdir -p /tmp
|
| 6 |
+
|
| 7 |
+
# # run app
|
| 8 |
+
# exec gunicorn --bind 0.0.0.0:7860 --workers 1 --threads 4 --timeout 120 app:app
|
| 9 |
+
|
| 10 |
+
|
| 11 |
#!/usr/bin/env bash
|
| 12 |
set -euo pipefail
|
| 13 |
|
| 14 |
+
# Ensure checkpoint directory exists
|
| 15 |
mkdir -p /tmp
|
| 16 |
|
| 17 |
+
# Set CPU threading limits
|
| 18 |
+
export OMP_NUM_THREADS=4
|
| 19 |
+
export MKL_NUM_THREADS=4
|
| 20 |
+
export OPENBLAS_NUM_THREADS=4
|
| 21 |
+
|
| 22 |
+
# Run app with gunicorn
|
| 23 |
+
# --workers 1: Single worker to avoid loading model multiple times
|
| 24 |
+
# --threads 4: Allow 4 threads per worker for concurrent requests
|
| 25 |
+
# --timeout 120: Allow 2 minutes for inference on CPU
|
| 26 |
+
# --preload: Load application code before forking workers (more efficient)
|
| 27 |
+
exec gunicorn \
|
| 28 |
+
--bind 0.0.0.0:7860 \
|
| 29 |
+
--workers 1 \
|
| 30 |
+
--threads 4 \
|
| 31 |
+
--timeout 120 \
|
| 32 |
+
--preload \
|
| 33 |
+
--access-logfile - \
|
| 34 |
+
--error-logfile - \
|
| 35 |
+
app:app
|