测试通过
This commit is contained in:
+33
-3
@@ -5,8 +5,6 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
cd "$ROOT"
|
||||
|
||||
PY="/home/xsl/miniconda3/envs/MuseTalk/bin/python"
|
||||
|
||||
if [[ -f ".env" ]]; then
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
@@ -14,6 +12,26 @@ if [[ -f ".env" ]]; then
|
||||
set +a
|
||||
fi
|
||||
|
||||
pick_python() {
|
||||
if [[ -n "${VISUAL_CHAT_PYTHON:-}" && -x "${VISUAL_CHAT_PYTHON}" ]]; then
|
||||
echo "$VISUAL_CHAT_PYTHON"
|
||||
return 0
|
||||
fi
|
||||
if [[ -n "${VIRTUAL_ENV:-}" && -x "${VIRTUAL_ENV}/bin/python" ]]; then
|
||||
echo "${VIRTUAL_ENV}/bin/python"
|
||||
return 0
|
||||
fi
|
||||
if [[ -x "/home/xsl/miniconda3/envs/MuseTalk/bin/python" ]]; then
|
||||
echo "/home/xsl/miniconda3/envs/MuseTalk/bin/python"
|
||||
return 0
|
||||
fi
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
command -v python3
|
||||
return 0
|
||||
fi
|
||||
command -v python
|
||||
}
|
||||
|
||||
normalize_host() {
|
||||
local host="${1:-0.0.0.0}"
|
||||
case "$host" in
|
||||
@@ -27,10 +45,22 @@ normalize_host() {
|
||||
}
|
||||
|
||||
HOST="$(normalize_host "${WEBRTC_HOST:-0.0.0.0}")"
|
||||
ARGS=(main:app --host "$HOST" --port "${WEBRTC_PORT:-8080}")
|
||||
PORT="${WEBRTC_PORT:-8080}"
|
||||
PY="$(pick_python)"
|
||||
SCHEME="http"
|
||||
ARGS=(main:app --host "$HOST" --port "$PORT")
|
||||
|
||||
if [[ -n "${SSL_CERTFILE:-}" && -n "${SSL_KEYFILE:-}" ]]; then
|
||||
SCHEME="https"
|
||||
ARGS+=(--ssl-certfile "$SSL_CERTFILE" --ssl-keyfile "$SSL_KEYFILE")
|
||||
fi
|
||||
|
||||
echo "repo: $ROOT"
|
||||
echo "python: $PY"
|
||||
echo "bind: ${HOST}:${PORT}"
|
||||
echo "listen: ${SCHEME}://${HOST}:${PORT}"
|
||||
echo "browser test page: ${SCHEME}://<server-ip>:${PORT}/"
|
||||
echo "note: only one browser page is allowed to own the session; a newer client replaces the older one."
|
||||
echo "note: after browser refresh, one click may still be required to resume mic/audio due to browser media policy."
|
||||
|
||||
exec "$PY" -m uvicorn "${ARGS[@]}"
|
||||
|
||||
@@ -80,5 +80,7 @@ echo "mode: $MODE"
|
||||
echo "bind: ${HOST}:${PORT}"
|
||||
echo "listen: ${SCHEME}://${HOST}:${PORT}"
|
||||
echo "browser test page: ${SCHEME}://<server-ip>:${PORT}/"
|
||||
echo "note: only one browser page is allowed to own the session; a newer client replaces the older one."
|
||||
echo "note: after browser refresh, one click may still be required to resume mic/audio due to browser media policy."
|
||||
|
||||
exec "$PY" -m uvicorn "${ARGS[@]}"
|
||||
Reference in New Issue
Block a user