File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class DownloadFileInput:
1919 save_path : Union [str , Path ]
2020 logger : logging .Logger
2121 sha256 : Optional [str ] = None
22+ verbose : bool = True
2223
2324
2425class DownloadFile :
@@ -27,6 +28,8 @@ class DownloadFile:
2728
2829 @classmethod
2930 def run (cls , input_params : DownloadFileInput ):
31+ cls .verbose = input_params .verbose
32+
3033 save_path = Path (input_params .save_path )
3134
3235 logger = input_params .logger
@@ -53,7 +56,8 @@ def _should_skip_download(
5356 return True
5457
5558 if cls .check_file_sha256 (path , expected_sha256 ):
56- logger .info ("File exists and is valid: %s" , path )
59+ if cls .verbose :
60+ logger .info ("File exists and is valid: %s" , path )
5761 return True
5862
5963 logger .warning ("File exists but is invalid, redownloading: %s" , path )
Original file line number Diff line number Diff line change @@ -37,9 +37,7 @@ def __init__(
3737 self .load_img = LoadImage ()
3838
3939 self .font_cfg = OmegaConf .load (FONT_YAML_PATH ).fonts
40-
4140 self .font_path = self .get_font_path (font_path , lang_type )
42- self .logger .info (f"Using { self .font_path } to visualize results." )
4341
4442 def __call__ (
4543 self ,
@@ -48,6 +46,8 @@ def __call__(
4846 txts : Optional [Union [List [str ], Tuple [str ]]] = None ,
4947 scores : Optional [Tuple [float ]] = None ,
5048 ) -> np .ndarray :
49+ self .logger .info (f"Using { self .font_path } to visualize results." )
50+
5151 if txts is None :
5252 return self .draw_dt_boxes (img_content , dt_boxes , scores )
5353 return self .draw_ocr_box_txt (img_content , dt_boxes , txts , scores )
@@ -120,6 +120,7 @@ def get_font_path(
120120 sha256 = font_sha256 ,
121121 save_path = save_font_path ,
122122 logger = self .logger ,
123+ verbose = False ,
123124 )
124125 DownloadFile .run (input_param )
125126 return str (save_font_path )
You can’t perform that action at this time.
0 commit comments