添加对NOUGAT的代理设置
This commit is contained in:
parent
af83c43fb0
commit
f925fe7692
@ -200,7 +200,7 @@ PATH_LOGGING = "gpt_log"
|
|||||||
|
|
||||||
|
|
||||||
# 除了连接OpenAI之外,还有哪些场合允许使用代理,请勿修改
|
# 除了连接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"]
|
||||||
|
|
||||||
|
|
||||||
# 自定义按钮的最大数量限制
|
# 自定义按钮的最大数量限制
|
||||||
|
@ -721,8 +721,10 @@ class nougat_interface():
|
|||||||
|
|
||||||
def nougat_with_timeout(self, command, cwd, timeout=3600):
|
def nougat_with_timeout(self, command, cwd, timeout=3600):
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from toolbox import ProxyNetworkActivate
|
||||||
logging.info(f'正在执行命令 {command}')
|
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:
|
try:
|
||||||
stdout, stderr = process.communicate(timeout=timeout)
|
stdout, stderr = process.communicate(timeout=timeout)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user