Update SW_run.py
Browse files
SW_run.py
CHANGED
|
@@ -6,12 +6,12 @@ import binascii # 用于将文本转换为十六进制
|
|
| 6 |
import re # 用于正则表达式
|
| 7 |
|
| 8 |
# 检查是否存在 logs_run.txt 文件,如果存在则删除它
|
| 9 |
-
log_file = '/
|
| 10 |
if os.path.exists(log_file):
|
| 11 |
os.remove(log_file)
|
| 12 |
|
| 13 |
# 检查是否存在 url.txt 文件,如果存在则删除它
|
| 14 |
-
url_file = '/
|
| 15 |
if os.path.exists(url_file):
|
| 16 |
os.remove(url_file)
|
| 17 |
|
|
@@ -29,13 +29,13 @@ logging.getLogger().addHandler(console_handler)
|
|
| 29 |
sys.stdout = logging.getLogger().handlers[0].stream
|
| 30 |
sys.stderr = logging.getLogger().handlers[0].stream
|
| 31 |
|
| 32 |
-
# 更改当前工作目录为 /
|
| 33 |
-
os.chdir('/
|
| 34 |
|
| 35 |
try:
|
| 36 |
-
# 在 try 块中运行 /
|
| 37 |
with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
|
| 38 |
-
process = subprocess.Popen(['python', '/
|
| 39 |
|
| 40 |
url_pattern = re.compile(r'https?://\S+')
|
| 41 |
|
|
|
|
| 6 |
import re # 用于正则表达式
|
| 7 |
|
| 8 |
# 检查是否存在 logs_run.txt 文件,如果存在则删除它
|
| 9 |
+
log_file = '/root/main/logs_run.txt'
|
| 10 |
if os.path.exists(log_file):
|
| 11 |
os.remove(log_file)
|
| 12 |
|
| 13 |
# 检查是否存在 url.txt 文件,如果存在则删除它
|
| 14 |
+
url_file = '/root/main/url.txt'
|
| 15 |
if os.path.exists(url_file):
|
| 16 |
os.remove(url_file)
|
| 17 |
|
|
|
|
| 29 |
sys.stdout = logging.getLogger().handlers[0].stream
|
| 30 |
sys.stderr = logging.getLogger().handlers[0].stream
|
| 31 |
|
| 32 |
+
# 更改当前工作目录为 /root/main
|
| 33 |
+
os.chdir('/root/main/')
|
| 34 |
|
| 35 |
try:
|
| 36 |
+
# 在 try 块中运行 /root/main/webui.py,并将输出重定向到日志文件
|
| 37 |
with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
|
| 38 |
+
process = subprocess.Popen(['python', '/root/main/launch.py', '--skip-torch-cuda-test', '--xformers', '--enable-insecure-extension-access', '--gradio-queue', '--multiple', '--disable-nan-check', '--no-hashing', '--opt-split-attention', '--disable-safe-unpickle', '--api', '--theme', 'dark', '--disable-console-progressbars', '--administrator'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
| 39 |
|
| 40 |
url_pattern = re.compile(r'https?://\S+')
|
| 41 |
|