Update main3.py
Browse files
main3.py
CHANGED
|
@@ -3,6 +3,7 @@ import re
|
|
| 3 |
import os
|
| 4 |
import subprocess
|
| 5 |
import sys
|
|
|
|
| 6 |
wget_path = '/usr/bin/wget'
|
| 7 |
|
| 8 |
params = {}
|
|
@@ -232,6 +233,8 @@ def rec_config_json():
|
|
| 232 |
"target_side_length": 4000.0,
|
| 233 |
"no_dpmpp_sde_batch_determinism": False,
|
| 234 |
"control_net_max_models_num": 3,
|
|
|
|
|
|
|
| 235 |
}
|
| 236 |
if params["image"] == "True":
|
| 237 |
json_content["outdir_txt2img_samples"] = "/content/drive/MyDrive/sd-generate/t2i"
|
|
@@ -305,7 +308,10 @@ css_content = '''
|
|
| 305 |
with open(f'{params["dir"]}/style.css', 'a') as cssFile:
|
| 306 |
cssFile.write(css_content)
|
| 307 |
# png_info脚本
|
| 308 |
-
if params["
|
|
|
|
|
|
|
|
|
|
| 309 |
subprocess.run([wget_path, '-O', f'{params["dir"]}/javascript/piw.js',
|
| 310 |
'https://huggingface.co/datasets/daasd/sd_backup/resolve/main/PNG_info_web.js'],
|
| 311 |
check=True)
|
|
@@ -324,6 +330,13 @@ if params["ui"] == "AUTOMATIC1111原版v1.5.1" and not os.path.exists(f'{params[
|
|
| 324 |
)''', '')
|
| 325 |
with open(f'{params["dir"]}/modules/ui.py', 'w') as writeFile:
|
| 326 |
writeFile.write(content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
|
| 328 |
# 11.11 httpx依赖更新
|
| 329 |
# 读取文件内容
|
|
|
|
| 3 |
import os
|
| 4 |
import subprocess
|
| 5 |
import sys
|
| 6 |
+
import shutil
|
| 7 |
wget_path = '/usr/bin/wget'
|
| 8 |
|
| 9 |
params = {}
|
|
|
|
| 233 |
"target_side_length": 4000.0,
|
| 234 |
"no_dpmpp_sde_batch_determinism": False,
|
| 235 |
"control_net_max_models_num": 3,
|
| 236 |
+
"hires_fix_show_sampler": True,
|
| 237 |
+
"hires_fix_show_prompts": True,
|
| 238 |
}
|
| 239 |
if params["image"] == "True":
|
| 240 |
json_content["outdir_txt2img_samples"] = "/content/drive/MyDrive/sd-generate/t2i"
|
|
|
|
| 308 |
with open(f'{params["dir"]}/style.css', 'a') as cssFile:
|
| 309 |
cssFile.write(css_content)
|
| 310 |
# png_info脚本
|
| 311 |
+
if params["png"] == "True":
|
| 312 |
+
if not os.path.exists(f'{params["dir"]}/tmp/ui.py'):
|
| 313 |
+
os.makedirs(f'{params["dir"]}/tmp')
|
| 314 |
+
shutil.copy(f'{params["dir"]}/modules/ui.py',f'{params["dir"]}/tmp/ui.py')
|
| 315 |
subprocess.run([wget_path, '-O', f'{params["dir"]}/javascript/piw.js',
|
| 316 |
'https://huggingface.co/datasets/daasd/sd_backup/resolve/main/PNG_info_web.js'],
|
| 317 |
check=True)
|
|
|
|
| 330 |
)''', '')
|
| 331 |
with open(f'{params["dir"]}/modules/ui.py', 'w') as writeFile:
|
| 332 |
writeFile.write(content)
|
| 333 |
+
print("已启用png_info脚本")
|
| 334 |
+
else:
|
| 335 |
+
if os.path.exists(f'{params["dir"]}/javascript/piw.js'):
|
| 336 |
+
os.remove(f'{params["dir"]}/javascript/piw.js')
|
| 337 |
+
if os.path.exists(f'{params["dir"]}/tmp/ui.py'):
|
| 338 |
+
shutil.copy(f'{params["dir"]}/tmp/ui.py',f'{params["dir"]}/modules/ui.py')
|
| 339 |
+
print("已禁用png_info脚本")
|
| 340 |
|
| 341 |
# 11.11 httpx依赖更新
|
| 342 |
# 读取文件内容
|