10 lines
455 B
Bash
Executable File
10 lines
455 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# STT CLI wrapper - calls llama server API
|
|
FILE="$1"
|
|
[ -z "$FILE" ] && { echo '{"ok":false,"error":"no file"}'; exit 1; }
|
|
[ ! -f "$FILE" ] && { echo "{\"ok\":false,\"error\":\"file not found: $FILE\"}"; exit 1; }
|
|
|
|
URL="http://llama:9090/api/stt"
|
|
RESULT=$(curl -s --max-time 60 -X POST "$URL" -F "file=@$FILE")
|
|
echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('text',''))" 2>/dev/null || echo "$RESULT"
|