Spaces:
Paused
Paused
#!/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() |