Spaces:
Paused
Paused
File size: 611 Bytes
73683aa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# model.py
import logging
from magic_pdf.model.doc_analyze_by_custom_model import ModelSingleton
def init_model():
"""
Initialize the document analysis models.
"""
try:
model_manager = ModelSingleton()
_ = model_manager.get_model(False, False)
logging.info("Text model initialized successfully")
_ = model_manager.get_model(True, False)
logging.info("OCR model initialized successfully")
return True
except Exception as e:
logging.exception("Model initialization failed: %s", e)
return False
model_initialized = init_model()
|