#!/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)