#!/usr/bin/env bash set -euo pipefail # Enable expressive model if the weight exists if [[ -f "models/Seamless/pretssel_melhifigan_wm.pt" ]]; then export USE_EXPRESSIVE_MODEL=1 fi HOST="${HOST:-0.0.0.0}" PORT="${PORT:-7860}" # If you use websockets / in-memory pubsub, multiple workers can break things. # Keep default 1, but allow override. WORKERS="${UVICORN_WORKERS:-1}" # If behind a reverse proxy, these help with client IP / scheme PROXY_HEADERS="${UVICORN_PROXY_HEADERS:-true}" ARGS=(app_pubsub:app --host "$HOST" --port "$PORT" --log-level "${UVICORN_LOG_LEVEL:-info}" --timeout-keep-alive "${UVICORN_KEEPALIVE:-75}") if [[ "$PROXY_HEADERS" == "true" ]]; then ARGS+=(--proxy-headers --forwarded-allow-ips "*") fi # Only set workers if explicitly >1 (safer default for websocket apps) if [[ "$WORKERS" -gt 1 ]]; then ARGS+=(--workers "$WORKERS") fi exec uvicorn "${ARGS[@]}"