From 48cb06067ed0ca160478ca807fd8d4af05cec915 Mon Sep 17 00:00:00 2001 From: Wang Xin Date: Mon, 20 May 2024 03:28:21 +0000 Subject: [PATCH 1/2] fix the issue of repeatedly downloading pretrained model --- ppocr/utils/network.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ppocr/utils/network.py b/ppocr/utils/network.py index fd2d8a64ba..ce06107111 100644 --- a/ppocr/utils/network.py +++ b/ppocr/utils/network.py @@ -24,6 +24,8 @@ def download_with_progressbar(url, save_path): + if save_path and os.path.exists(save_path): + return logger = get_logger() response = requests.get(url, stream=True) if response.status_code == 200: From 0ccd94567a814cfbdb63f1d520f4c9b0a6d04ab7 Mon Sep 17 00:00:00 2001 From: Wang Xin Date: Mon, 20 May 2024 11:09:54 +0000 Subject: [PATCH 2/2] add log info --- ppocr/utils/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ppocr/utils/network.py b/ppocr/utils/network.py index ce06107111..71d050c8a3 100644 --- a/ppocr/utils/network.py +++ b/ppocr/utils/network.py @@ -24,9 +24,10 @@ def download_with_progressbar(url, save_path): + logger = get_logger() if save_path and os.path.exists(save_path): + logger.info(f"Path {save_path} already exists. Skipping...") return - logger = get_logger() response = requests.get(url, stream=True) if response.status_code == 200: total_size_in_bytes = int(response.headers.get("content-length", 1))