From f925fe76923a88845f0db3299089ba8ccb4f7756 Mon Sep 17 00:00:00 2001 From: binary-husky Date: Wed, 18 Oct 2023 16:58:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9NOUGAT=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 2 +- crazy_functions/crazy_utils.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 1d2aa69..46ca55f 100644 --- a/config.py +++ b/config.py @@ -200,7 +200,7 @@ PATH_LOGGING = "gpt_log" # 除了连接OpenAI之外,还有哪些场合允许使用代理,请勿修改 -WHEN_TO_USE_PROXY = ["Download_LLM", "Download_Gradio_Theme", "Connect_Grobid", "Warmup_Modules"] +WHEN_TO_USE_PROXY = ["Download_LLM", "Download_Gradio_Theme", "Connect_Grobid", "Warmup_Modules", "Nougat_Download"] # 自定义按钮的最大数量限制 diff --git a/crazy_functions/crazy_utils.py b/crazy_functions/crazy_utils.py index c6a4155..8533d08 100644 --- a/crazy_functions/crazy_utils.py +++ b/crazy_functions/crazy_utils.py @@ -721,8 +721,10 @@ class nougat_interface(): def nougat_with_timeout(self, command, cwd, timeout=3600): import subprocess + from toolbox import ProxyNetworkActivate logging.info(f'正在执行命令 {command}') - process = subprocess.Popen(command, shell=True, cwd=cwd) + with ProxyNetworkActivate("Nougat_Download"): + process = subprocess.Popen(command, shell=True, cwd=cwd, env=os.environ) try: stdout, stderr = process.communicate(timeout=timeout) except subprocess.TimeoutExpired: