65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
import paddleocr
|
|
import os
|
|
|
|
def test_paddleocr_simple():
|
|
"""Simple test for PaddleOCR without complex initialization"""
|
|
print("Testing PaddleOCR with simple initialization...")
|
|
|
|
try:
|
|
# Try with minimal configuration
|
|
ocr = paddleocr.PaddleOCR(lang='en')
|
|
print("✅ PaddleOCR initialized successfully with minimal config")
|
|
|
|
# Check if we can create an instance without errors
|
|
print("✅ PaddleOCR instance created")
|
|
|
|
return True
|
|
|
|
except Exception as e:
|
|
print(f"❌ PaddleOCR initialization failed: {e}")
|
|
return False
|
|
|
|
def check_paddleocr_requirements():
|
|
"""Check if required dependencies are available"""
|
|
print("Checking PaddleOCR dependencies...")
|
|
|
|
try:
|
|
import paddle
|
|
print(f"✅ PaddlePaddle version: {paddle.__version__}")
|
|
except ImportError:
|
|
print("❌ PaddlePaddle not installed")
|
|
return False
|
|
|
|
try:
|
|
import cv2
|
|
print(f"✅ OpenCV version: {cv2.__version__}")
|
|
except ImportError:
|
|
print("❌ OpenCV not installed")
|
|
return False
|
|
|
|
try:
|
|
import numpy
|
|
print(f"✅ NumPy version: {numpy.__version__}")
|
|
except ImportError:
|
|
print("❌ NumPy not installed")
|
|
return False
|
|
|
|
return True
|
|
|
|
if __name__ == "__main__":
|
|
print("🧪 PaddleOCR Dependency Check")
|
|
print("=" * 40)
|
|
|
|
deps_ok = check_paddleocr_requirements()
|
|
print()
|
|
|
|
if deps_ok:
|
|
print("🔧 Testing PaddleOCR initialization...")
|
|
ocr_ok = test_paddleocr_simple()
|
|
|
|
if ocr_ok:
|
|
print("\n🎉 PaddleOCR configuration is working!")
|
|
else:
|
|
print("\n⚠️ PaddleOCR has initialization issues but dependencies are present")
|
|
else:
|
|
print("\n❌ Missing required dependencies for PaddleOCR") |