Repository navigation
Expand file tree
/
Copy pathserver.sh
More file actions
executable file
·48 lines (39 loc) · 1.67 KB
/
Copy pathserver.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# server.sh — start the tts-server HTTP API (host/port from .env, default 127.0.0.1:8000).
#
# Uses the customvoice model by default (built-in named speakers).
# Pass --base to use the base model (embedding-based voice cloning via POST /v1/audio/voices).
# Model and codec paths are read from .env.
set -euo pipefail
TITLE="qwentts.cpp - server"
# Set terminal window title
echo -ne "\033]0;$TITLE\007"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# ── load defaults ────────────────────────────────────────────────────
if [[ ! -f "$SCRIPT_DIR/.env" ]]; then
echo "Error: .env file not found." >&2
echo "Copy .env.example to .env and configure it:" >&2
echo " cp .env.example .env" >&2
echo " # Then edit .env to set QWENTTS_PATH and other settings" >&2
exit 1
fi
set -a; source "$SCRIPT_DIR/.env"; set +a
# ── model selection ─────────────────────────────────────────────────
MODEL_VAR="QWENTTS_CUSTOMVOICE_MODEL"
for arg in "$@"; do
case "$arg" in
--base) MODEL_VAR="QWENTTS_BASE_MODEL" ;;
--customvoice) MODEL_VAR="QWENTTS_CUSTOMVOICE_MODEL" ;;
esac
done
MODEL="${!MODEL_VAR}"
if [[ -z "$MODEL" ]]; then
echo "Error: $MODEL_VAR is not set in .env" >&2
exit 1
fi
HOST="${QWENTTS_SERVER_HOST:-127.0.0.1}"
PORT="${QWENTTS_SERVER_PORT:-8000}"
"$QWENTTS_PATH/build/tts-server" \
--model "$QWENTTS_PATH/models/$MODEL" \
--codec "$QWENTTS_PATH/models/$QWENTTS_CODEC_MODEL" \
--host "$HOST" --port "$PORT" --lang auto