enabled MPS support for easyOCR

This commit is contained in:
Dillon DuPont
2025-04-04 09:22:16 -04:00
parent 0836bb7e8f
commit 6815d8a182

View File

@@ -67,17 +67,9 @@ class OCRProcessor:
import easyocr
# Use GPU if available
use_gpu = self.device in ["cuda"] # MPS not directly supported by EasyOCR
# If using MPS, add warnings to explain why CPU is used
if self.device == "mps":
logger.warning("EasyOCR doesn't support MPS directly. Using CPU instead.")
logger.warning(
"To silence this warning, set environment variable: PYTORCH_ENABLE_MPS_FALLBACK=1"
)
use_gpu = self.device in ["cuda", "mps"]
self.reader = easyocr.Reader(["en"], gpu=use_gpu)
# Verify reader initialization
if self.reader is None:
raise ValueError("Failed to initialize EasyOCR reader")