-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
52 lines (43 loc) · 1.53 KB
/
Copy pathstart.sh
File metadata and controls
52 lines (43 loc) · 1.53 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
49
50
51
52
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HOST="${HOST:-0.0.0.0}"
PORT="${PORT:-8000}"
WORKERS="${WORKERS:-1}"
export WHISPER_BIN="${WHISPER_BIN:-${SCRIPT_DIR}/whisper.cpp/build/bin/whisper-cli}"
export WHISPER_MODEL="${WHISPER_MODEL:-${SCRIPT_DIR}/whisper.cpp/models/ggml-tiny.bin}"
export WHISPER_MAX_CONCURRENT="${WHISPER_MAX_CONCURRENT:-2}"
log() { echo "[SERVER] $(date '+%H:%M:%S') $*"; }
# Auto-setup: build whisper.cpp and download model if missing
if [ ! -f "${WHISPER_BIN}" ] || [ ! -f "${WHISPER_MODEL}" ]; then
log "whisper binary or model not found -- running setup.sh..."
if [ -f "${SCRIPT_DIR}/setup.sh" ]; then
bash "${SCRIPT_DIR}/setup.sh"
else
echo "ERROR: setup.sh not found at ${SCRIPT_DIR}/setup.sh"
exit 1
fi
fi
# Verify after setup
if [ ! -f "${WHISPER_BIN}" ]; then
echo "ERROR: whisper-cli still not found at ${WHISPER_BIN} after setup"
exit 1
fi
if [ ! -f "${WHISPER_MODEL}" ]; then
echo "ERROR: Model still not found at ${WHISPER_MODEL} after setup"
exit 1
fi
log "Starting Whisper Live Transcription API..."
log " Binary: ${WHISPER_BIN}"
log " Model: ${WHISPER_MODEL} ($(du -h "${WHISPER_MODEL}" | cut -f1))"
log " Host: ${HOST}:${PORT}"
log " Workers: ${WORKERS}"
log " Web UI: http://localhost:${PORT}/"
log " Docs: http://localhost:${PORT}/docs"
log ""
cd "${SCRIPT_DIR}"
exec uvicorn app.main:app \
--host "${HOST}" \
--port "${PORT}" \
--workers "${WORKERS}" \
--log-level info