| |
| |
| |
| |
|
|
| import os |
|
|
| HF_TOKEN = os.getenv("HF_TOKEN", None) |
|
|
| AVAILABLE_VOICES = [ |
| "alba", |
| "marius", |
| "javert", |
| "jean", |
| "fantine", |
| "cosette", |
| "eponine", |
| "azelma" |
| ] |
|
|
| DEFAULT_VOICE = "alba" |
| DEFAULT_MODEL_VARIANT = "b6369a24" |
| DEFAULT_TEMPERATURE = 0.7 |
| DEFAULT_LSD_DECODE_STEPS = 1 |
| DEFAULT_EOS_THRESHOLD = -4.0 |
| DEFAULT_NOISE_CLAMP = 0.0 |
| DEFAULT_FRAMES_AFTER_EOS = 10 |
|
|
| VOICE_MODE_PRESET = "Preset Voices" |
| VOICE_MODE_CLONE = "Voice Cloning" |
|
|
| VOICE_STATE_CACHE_MAXIMUM_SIZE = 8 |
| VOICE_STATE_CACHE_CLEANUP_THRESHOLD = 4 |
|
|
| BACKGROUND_CLEANUP_INTERVAL = 300 |
|
|
| MAXIMUM_INPUT_LENGTH = 2000 |
|
|
| TEMPORARY_FILE_LIFETIME_SECONDS = 7200 |
|
|
| MAXIMUM_MEMORY_USAGE = 1 * 1024 * 1024 * 1024 |
| MEMORY_WARNING_THRESHOLD = int(0.7 * MAXIMUM_MEMORY_USAGE) |
| MEMORY_CRITICAL_THRESHOLD = int(0.85 * MAXIMUM_MEMORY_USAGE) |
| MEMORY_CHECK_INTERVAL = 30 |
| MEMORY_IDLE_TARGET = int(0.5 * MAXIMUM_MEMORY_USAGE) |
|
|
| MAXIMUM_VOICE_CLONE_FILE_SIZE_BYTES = 1 * 1024 * 1024 |
|
|
| AUDIO_CONVERSION_QUEUE_TIMEOUT_SECONDS = 60 |
|
|
| MODEL_LOAD_RETRY_ATTEMPTS = 3 |
| MODEL_LOAD_RETRY_DELAY_SECONDS = 1.0 |
| MODEL_UNLOAD_WAIT_TIMEOUT_SECONDS = 5.0 |
|
|
| SUPPORTED_AUDIO_EXTENSIONS = [ |
| ".wav", |
| ".mp3", |
| ".flac", |
| ".ogg", |
| ".m4a", |
| ".aac", |
| ".wma", |
| ".aiff", |
| ".aif", |
| ".opus", |
| ".webm", |
| ".mp4", |
| ".mkv", |
| ".avi", |
| ".mov", |
| ".3gp" |
| ] |
|
|
| AUDIO_FORMAT_DISPLAY_NAME_OVERRIDES = { |
| "m4a": "M4A/AAC", |
| "aif": "AIFF", |
| "3gp": "3GP" |
| } |
|
|
| EXAMPLE_PROMPTS = [ |
| { |
| "text": "The quick brown fox jumps over the lazy dog near the riverbank.", |
| "voice": "alba" |
| }, |
| { |
| "text": "Welcome to the future of text to speech technology powered by artificial intelligence.", |
| "voice": "marius" |
| }, |
| { |
| "text": "Technology continues to push the boundaries of what we thought was possible.", |
| "voice": "javert" |
| }, |
| { |
| "text": "The weather today is absolutely beautiful and perfect for a relaxing walk outside.", |
| "voice": "fantine" |
| }, |
| { |
| "text": "Science and innovation are transforming how we interact with the world around us.", |
| "voice": "jean" |
| } |
| ] |
|
|
| KYUTAI_LOGO_URL = "https://cdn-avatars.huggingface.co/v1/production/uploads/6355a3c1805be5a8f30fea49/8xGdIOlfkopZfhbMitw_k.jpeg" |
| POCKET_TTS_LOGO_URL = "https://raw.githubusercontent.com/kyutai-labs/pocket-tts/refs/heads/main/docs/logo.png" |
|
|
| SPACE_INFO = "Pocket TTS" |
|
|
| HEADER_LINKS = [ |
| {"icon": "🔊", "text": "Demo", "url": "https://kyutai.org/tts"}, |
| {"icon": "🐱💻", "text": "GitHub", "url": "https://github.com/kyutai-labs/pocket-tts"}, |
| {"icon": "🤗", "text": "Model Card", "url": "https://huggingface.co/kyutai/pocket-tts"}, |
| {"icon": "🤗", "text": "Space", "url": "https://huggingface.co/spaces/hadadxyz/pocket-tts-hf-cpu-optimized"}, |
| {"icon": "📄", "text": "Paper", "url": "https://arxiv.org/abs/2509.06926"}, |
| {"icon": "📚", "text": "Docs", "url": "https://github.com/kyutai-labs/pocket-tts/tree/main/docs"}, |
| ] |
|
|
| COPYRIGHT_NAME = "Hadad Darajat" |
| COPYRIGHT_URL = "https://www.linkedin.com/in/hadadrjt" |
|
|
| DESIGN_BY_NAME = "D3vShoaib/pocket-tts" |
| DESIGN_BY_URL = f"https://huggingface.co/spaces/{DESIGN_BY_NAME}" |
|
|
| ACCELERATOR_SOCKET_PATH = "/app/pocket_tts_accelerator.sock" |
| ACCELERATOR_BINARY_PATH = "/app/bin/pocket_tts_accelerator" |
| ACCELERATOR_WORKER_THREADS = 1 |
| ACCELERATOR_MEMORY_POOL_MB = 64 |
| ACCELERATOR_LOG_PREFIX = "[ACCELERATOR]" |
| ACCELERATOR_ENABLED = True |
|
|
| PYTORCH_COMPUTATION_THREADS = max(2, (os.cpu_count() or 4)) |
| PYTORCH_INTEROP_THREADS = max(1, (os.cpu_count() or 4) // 2) |