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: