Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| """ | |
| Environment validation script for AI Interview Coach | |
| Run this before deploying to check for common issues | |
| """ | |
| import os | |
| import sys | |
| def check_environment(): | |
| """Check if the environment is properly configured""" | |
| issues = [] | |
| # Check for required environment variables | |
| if not os.environ.get("GROQ_API_KEY"): | |
| issues.append("β GROQ_API_KEY environment variable is not set") | |
| else: | |
| print("β GROQ_API_KEY is set") | |
| # Check for required directories | |
| required_dirs = ['uploads', 'reports'] | |
| for dir_name in required_dirs: | |
| if not os.path.exists(dir_name): | |
| issues.append(f"β Directory '{dir_name}' does not exist") | |
| else: | |
| print(f"β Directory '{dir_name}' exists") | |
| # Check for voice model file | |
| voice_model_path = './voice_model/en_US-lessac-medium.onnx' | |
| if not os.path.exists(voice_model_path): | |
| issues.append(f"β οΈ Voice model file not found at {voice_model_path} (TTS will be disabled)") | |
| else: | |
| print("β Voice model file found") | |
| # Try to import critical modules | |
| try: | |
| import gradio | |
| print("β Gradio imported successfully") | |
| except ImportError: | |
| issues.append("β Gradio not installed") | |
| try: | |
| from groq import Groq | |
| print("β Groq imported successfully") | |
| except ImportError: | |
| issues.append("β Groq not installed") | |
| # Summary | |
| if issues: | |
| print("\nπ¨ Issues found:") | |
| for issue in issues: | |
| print(f" {issue}") | |
| print(f"\nFound {len(issues)} issue(s) that need to be addressed.") | |
| return False | |
| else: | |
| print("\nπ All checks passed! Ready for deployment.") | |
| return True | |
| if __name__ == "__main__": | |
| success = check_environment() | |
| sys.exit(0 if success else 1) | |