Skip to content

Commit 3dbfd14

Browse files
committed
feat: add environment variable support for debug mode in mineru_client
1 parent 0fe03d5 commit 3dbfd14

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mineru_vl_utils/mineru_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import asyncio
22
import math
3+
import os
34
import re
45
from concurrent.futures import Executor
56
from typing import Literal, Sequence
67

78
from PIL import Image
9+
from loguru import logger
810

911
from .post_process import post_process
1012
from .structs import BLOCK_TYPES, ContentBlock
@@ -318,6 +320,15 @@ def __init__(
318320
max_retries: int = 3, # for http-client backend only
319321
retry_backoff_factor: float = 0.5, # for http-client backend only
320322
) -> None:
323+
env_debug_value = os.getenv('MINERU_VL_DEBUG_ENABLE', '')
324+
if env_debug_value:
325+
if env_debug_value.lower() in ['true', '1', 'yes']:
326+
debug = True
327+
elif env_debug_value.lower() in ['false', '0', 'no']:
328+
debug = False
329+
else:
330+
logger.warning(f'unknown MINERU_VL_DEBUG_ENABLE config: {env_debug_value}, pass')
331+
321332
if backend == "transformers":
322333
if model is None or processor is None:
323334
if not model_path:

0 commit comments

Comments
 (0)