File size: 2,993 Bytes
26e8660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python3
"""
Test script to verify AI Resume Screener installation
"""

import sys
import importlib

def test_import(module_name, package_name=None):
    """Test if a module can be imported"""
    try:
        importlib.import_module(module_name)
        print(f"βœ… {package_name or module_name}")
        return True
    except ImportError as e:
        print(f"❌ {package_name or module_name}: {e}")
        return False

def main():
    print("πŸ§ͺ Testing AI Resume Screener Installation\n")
    
    # Core dependencies
    print("πŸ“¦ Core Dependencies:")
    core_deps = [
        ("streamlit", "Streamlit"),
        ("pandas", "Pandas"),
        ("numpy", "NumPy"),
        ("plotly", "Plotly"),
    ]
    
    core_success = all(test_import(module, name) for module, name in core_deps)
    
    # ML/AI dependencies
    print("\nπŸ€– ML/AI Dependencies:")
    ml_deps = [
        ("sentence_transformers", "Sentence Transformers"),
        ("transformers", "Transformers"),
        ("torch", "PyTorch"),
        ("faiss", "FAISS"),
        ("rank_bm25", "Rank BM25"),
        ("nltk", "NLTK"),
    ]
    
    ml_success = all(test_import(module, name) for module, name in ml_deps)
    
    # File processing dependencies
    print("\nπŸ“„ File Processing Dependencies:")
    file_deps = [
        ("pdfplumber", "PDF Plumber"),
        ("PyPDF2", "PyPDF2"),
        ("docx", "python-docx"),
        ("datasets", "Hugging Face Datasets"),
    ]
    
    file_success = all(test_import(module, name) for module, name in file_deps)
    
    # Optional dependencies
    print("\n⚑ Optional Dependencies:")
    optional_deps = [
        ("accelerate", "Accelerate"),
        ("bitsandbytes", "BitsAndBytes"),
    ]
    
    for module, name in optional_deps:
        test_import(module, name)
    
    # Summary
    print("\n" + "="*50)
    if core_success and ml_success and file_success:
        print("πŸŽ‰ All required dependencies are installed!")
        print("βœ… Ready to run AI Resume Screener")
        
        # Test basic functionality
        print("\nπŸ”§ Testing basic functionality...")
        try:
            import pandas as pd
            import numpy as np
            from sentence_transformers import SentenceTransformer
            
            # Test data creation
            test_df = pd.DataFrame({'test': [1, 2, 3]})
            test_array = np.array([1, 2, 3])
            
            print("βœ… Pandas and NumPy working")
            print("βœ… Installation test completed successfully!")
            
        except Exception as e:
            print(f"❌ Basic functionality test failed: {e}")
            
    else:
        print("❌ Some required dependencies are missing")
        print("πŸ“ Please install missing packages using:")
        print("   pip install -r requirements.txt")
        
    print("\nπŸš€ To run the application:")
    print("   streamlit run src/streamlit_app.py")

if __name__ == "__main__":
    main()