-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_dependencies.py
More file actions
44 lines (41 loc) · 1.17 KB
/
Copy pathcheck_dependencies.py
File metadata and controls
44 lines (41 loc) · 1.17 KB
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
def check_dependencies():
dependencies = [
'torch',
'torchvision',
'numpy',
'cv2',
'PIL',
'easyocr',
'transformers',
'sklearn',
'matplotlib',
'seaborn',
'fastapi',
'uvicorn',
'tqdm',
'pytorch_grad_cam'
]
missing = []
for dep in dependencies:
try:
if dep == 'cv2':
import cv2
elif dep == 'PIL':
from PIL import Image
else:
__import__(dep)
print(f"✅ {dep} is installed")
except ImportError:
missing.append(dep)
print(f"❌ {dep} is missing")
if missing:
print("\n❌ Some dependencies are missing. Please install them using:")
if 'cv2' in missing:
missing[missing.index('cv2')] = 'opencv-python'
if 'PIL' in missing:
missing[missing.index('PIL')] = 'Pillow'
print(f"pip install {' '.join(missing)}")
else:
print("\n✅ All dependencies are installed!")
if __name__ == "__main__":
check_dependencies()