ai-server / app.py
nuernie
adjust
42e1e02
raw
history blame
859 Bytes
import os
import logging
from whisper_live.server import TranscriptionServer
# Set up HuggingFace cache directory in /tmp for Docker compatibility
cache_dir = '/tmp/huggingface_cache'
os.makedirs(cache_dir, exist_ok=True) # Ensure the directory exists
os.environ['HF_HOME'] = cache_dir
# β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
# Logging
# β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
if __name__ == "__main__":
# Create and start the transcription server
transcription_server = TranscriptionServer()
transcription_server.run(
host='0.0.0.0',
port=7860, # Using the default WebSocket port from the whisper_live library
backend='faster_whisper'
)