Spaces:
Runtime error
Runtime error
File size: 3,690 Bytes
674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 c13c2e9 674a887 | 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | """
Verification script for Camera Models Explorer setup
Checks all dependencies and system requirements
"""
import sys
import subprocess
def check_python_version():
"""Check Python version"""
print("π Checking Python version...")
version = sys.version_info
if version.major == 3 and version.minor >= 11:
print(f" β
Python {version.major}.{version.minor}.{version.micro} - OK")
return True
else:
print(f" β Python {version.major}.{version.minor} - Need 3.11+")
return False
def check_package(package_name, import_name=None):
"""Check if a package is installed"""
if import_name is None:
import_name = package_name
try:
__import__(import_name)
print(f" β
{package_name} - OK")
return True
except ImportError:
print(f" β {package_name} - NOT FOUND")
return False
def check_dependencies():
"""Check all required Python packages"""
print("\nπ¦ Checking Python dependencies...")
packages = [
("streamlit", "streamlit"),
("numpy", "numpy"),
("OpenCV", "cv2"),
("Pillow", "PIL"),
("matplotlib", "matplotlib"),
("huggingface_hub", "huggingface_hub"),
]
results = []
for pkg_name, import_name in packages:
results.append(check_package(pkg_name, import_name))
return all(results)
def check_streamlit():
"""Check if streamlit can import core components"""
print("\nπ¨ Checking Streamlit functionality...")
try:
import streamlit as st
print(" β
Streamlit imports - OK")
return True
except Exception as e:
print(f" β Streamlit error: {e}")
return False
def check_cv2():
"""Check OpenCV functionality"""
print("\nπ· Checking OpenCV functionality...")
try:
import cv2
import numpy as np
# Try basic operations
test_img = np.zeros((100, 100, 3), dtype=np.uint8)
result = cv2.cvtColor(test_img, cv2.COLOR_BGR2RGB)
print(" β
OpenCV operations - OK")
return True
except Exception as e:
print(f" β OpenCV error: {e}")
return False
def check_huggingface():
"""Check HuggingFace Hub functionality"""
print("\nπ€ Checking Hugging Face Hub...")
try:
from huggingface_hub import hf_hub_download, list_repo_files
print(" β
Hugging Face Hub imports - OK")
return True
except Exception as e:
print(f" β Hugging Face Hub error: {e}")
return False
def main():
"""Run all checks"""
print("=" * 50)
print("π· Camera Models Explorer - Setup Verification")
print("=" * 50)
checks = [
("Python Version", check_python_version),
("Dependencies", check_dependencies),
("Streamlit", check_streamlit),
("OpenCV", check_cv2),
("Hugging Face Hub", check_huggingface),
]
results = []
for name, check_fn in checks:
try:
result = check_fn()
results.append(result)
except Exception as e:
print(f"\nβ Error checking {name}: {e}")
results.append(False)
print("\n" + "=" * 50)
if all(results):
print("β
All checks passed! You're ready to run the app.")
print("\nStart the app with:")
print(" make run")
print("or")
print(" streamlit run app.py")
return 0
else:
print("β Some checks failed. Please install missing dependencies:")
print(" pip install -r requirements.txt")
return 1
if __name__ == "__main__":
sys.exit(main())
|