cv-analyser / check_ocr_deps.py
Dzunisani007's picture
Fix Hugging Face deployment issues
83c9f71
raw
history blame contribute delete
977 Bytes
import subprocess
import shutil
def check_env():
print("Checking for Tesseract...")
tess_path = shutil.which("tesseract")
if tess_path:
print(f"Tesseract found: {tess_path}")
try:
res = subprocess.run(["tesseract", "--version"], capture_output=True, text=True)
print(res.stdout)
except Exception as e:
print(f"Error running tesseract: {e}")
else:
print("Tesseract NOT found in PATH")
print("\nChecking for pdftoppm (poppler)...")
poppler_path = shutil.which("pdftoppm")
if poppler_path:
print(f"pdftoppm found: {poppler_path}")
try:
res = subprocess.run(["pdftoppm", "-v"], capture_output=True, text=True)
print(res.stderr) # pdftoppm prints version to stderr
except Exception as e:
print(f"Error running pdftoppm: {e}")
else:
print("pdftoppm NOT found in PATH")
if __name__ == "__main__":
check_env()