chua's picture
Publish Audio8 ASR ONNX runtime
bc8e2a9
Raw
History Blame Contribute Delete
657 Bytes
#!/usr/bin/env bash
set -euo pipefail
HOST="${1:-127.0.0.1}"
PORT="${2:-7860}"
if [[ $# -lt 3 ]]; then
echo "Usage: $0 [host] [port] /path/to/audio.wav" >&2
exit 2
fi
AUDIO_PATH="$3"
BASE_URL="http://${HOST}:${PORT}"
PYTHON_BIN="${PYTHON:-python3}"
CURL_LOCAL=(curl --noproxy "*" -fsS)
echo "[smoke] health ${BASE_URL}/health"
"${CURL_LOCAL[@]}" "${BASE_URL}/health" | "$PYTHON_BIN" -m json.tool
echo "[smoke] asr ${AUDIO_PATH}"
"${CURL_LOCAL[@]}" -X POST "${BASE_URL}/asr" \
-F "audio=@${AUDIO_PATH}" \
-F "language=Chinese" \
-F "max_new_tokens=64" \
-F "cache_precision=int8" \
-F "audio_precision=int8" \
| "$PYTHON_BIN" -m json.tool