first
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
VENV_DIR="$ROOT_DIR/.venv"
|
||||
REQ_FILE="$ROOT_DIR/demo/requirements.txt"
|
||||
UI_PORT="${UI_PORT:-8420}"
|
||||
if [ -f "$ROOT_DIR/.env" ]; then
|
||||
set -a
|
||||
source "$ROOT_DIR/.env"
|
||||
set +a
|
||||
fi
|
||||
S2S_PROXY_TARGET="${S2S_PROXY_TARGET:-ws://ai-server:12345/v1/realtime}"
|
||||
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
echo "Errore: python3 non trovato."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$VENV_DIR" ]; then
|
||||
echo "Creazione ambiente virtuale in .venv..."
|
||||
python3 -m venv "$VENV_DIR"
|
||||
fi
|
||||
|
||||
source "$VENV_DIR/bin/activate"
|
||||
|
||||
if [ ! -f "$REQ_FILE" ]; then
|
||||
echo "Errore: file requirements non trovato: $REQ_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! python -c "import fastapi, uvicorn, httpx, huggingface_hub, dotenv" >/dev/null 2>&1; then
|
||||
echo "Installazione dipendenze da demo/requirements.txt..."
|
||||
python -m pip install -r "$REQ_FILE"
|
||||
fi
|
||||
|
||||
export S2S_PROXY_TARGET
|
||||
|
||||
echo "💻 Avvio dell'interfaccia Demo UI (Porta $UI_PORT)..."
|
||||
echo "🔌 Proxy realtime verso $S2S_PROXY_TARGET"
|
||||
echo "💡 Premi Ctrl+C in questo terminale per fermarla."
|
||||
echo "----------------------------------------------------"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
PYTHONPATH=demo python -m uvicorn demo.server:app --host 0.0.0.0 --port "$UI_PORT" --reload
|
||||
Reference in New Issue
Block a user