File size: 1,871 Bytes
2c970f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/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)