Download debug_env_vars.py from pgits/voiceCal: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/spaces/pgits/voiceCal/resolve/main/debug_env_vars.py
- Command line
-
hf download hf://spaces/pgits/voiceCal/debug_env_vars.py
-
curl -L -o debug_env_vars.py https://huggingface.co/spaces/pgits/voiceCal/resolve/main/debug_env_vars.py
1.94 kB
| #!/usr/bin/env python3 | |
| """ | |
| Debug script to check environment variables in Hugging Face Spaces | |
| """ | |
| import os | |
| import sys | |
| def check_environment_variables(): | |
| """Check if environment variables are properly set""" | |
| print("π ENVIRONMENT VARIABLE DIAGNOSTIC") | |
| print("=" * 50) | |
| # Check all environment variables | |
| print("π All Environment Variables:") | |
| env_vars = dict(os.environ) | |
| # Look for our specific variables | |
| target_vars = ["STT_SERVICE_MODE", "TTS_SERVICE_MODE"] | |
| print(f"\nπ― Target Variables:") | |
| for var in target_vars: | |
| value = os.environ.get(var, "NOT SET") | |
| print(f" {var} = '{value}'") | |
| print(f"\nπ All Variables Starting with 'STT' or 'TTS':") | |
| for key, value in env_vars.items(): | |
| if key.startswith(("STT", "TTS")): | |
| print(f" {key} = '{value}'") | |
| print(f"\nπ Total Environment Variables: {len(env_vars)}") | |
| # Check common HF environment variables | |
| print(f"\nπ Hugging Face Environment:") | |
| hf_vars = ["SPACE_ID", "SPACE_AUTHOR", "SPACE_REPO", "SPACE_TITLE"] | |
| for var in hf_vars: | |
| value = os.environ.get(var, "NOT SET") | |
| print(f" {var} = '{value}'") | |
| # Test our service mode detection | |
| print(f"\nποΈ Service Mode Detection Test:") | |
| stt_mode = os.environ.get("STT_SERVICE_MODE", "websocket").lower() | |
| tts_mode = os.environ.get("TTS_SERVICE_MODE", "websocket").lower() | |
| print(f" STT Mode Detected: '{stt_mode}'") | |
| print(f" TTS Mode Detected: '{tts_mode}'") | |
| if stt_mode == "websocket": | |
| print(" β STT should run in WebSocket mode") | |
| else: | |
| print(" β STT will NOT run in WebSocket mode") | |
| if tts_mode == "websocket": | |
| print(" β TTS should run in WebSocket mode") | |
| else: | |
| print(" β TTS will NOT run in WebSocket mode") | |
| if __name__ == "__main__": | |
| check_environment_variables() |