forked from efforting.tech/stt-server
Load HF_TOKEN from token file at startup (consistent with tts-server)
Reads ~/.secrets/hugging-face.token by default, overridable via HF_TOKEN_FILE. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,7 @@ Usage:
|
||||
./stt-server.py --model large-v3 --device cuda --compute-type int8_float16 --verbose
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import signal
|
||||
@@ -123,6 +124,13 @@ parser.add_argument('--verbose', '-v', action='store_true')
|
||||
args = parser.parse_args()
|
||||
verbose = args.verbose
|
||||
|
||||
token_file = os.environ.get('HF_TOKEN_FILE', os.path.expanduser('~/.secrets/hugging-face.token'))
|
||||
try:
|
||||
with open(token_file) as f:
|
||||
os.environ['HF_TOKEN'] = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
from faster_whisper import WhisperModel
|
||||
from huggingface_hub import snapshot_download
|
||||
|
||||
|
||||
Reference in New Issue
Block a user