daasd commited on
Commit
e0d1cd2
·
verified ·
1 Parent(s): a64ac83

Update main3.py

Browse files
Files changed (1) hide show
  1. main3.py +18 -18
main3.py CHANGED
@@ -305,25 +305,25 @@ css_content = '''
305
  with open(f'{params["dir"]}/style.css', 'a') as cssFile:
306
  cssFile.write(css_content)
307
  # png_info脚本
308
- # if params["ui"] == "AUTOMATIC1111原版v1.5.1":
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)
312
- # # 拦截png_info
313
- # with open(f'{params["dir"]}/modules/ui.py', 'r') as readFile:
314
- # content = readFile.read()
315
- # content = content.replace(''' for tabname, button in buttons.items():
316
- # parameters_copypaste.register_paste_params_button(parameters_copypaste.ParamBinding(
317
- # paste_button=button, tabname=tabname, source_text_component=generation_info, source_image_component=image,
318
- # ))
319
 
320
- # image.change(
321
- # fn=wrap_gradio_call(modules.extras.run_pnginfo),
322
- # inputs=[image],
323
- # outputs=[html, generation_info, html2],
324
- # )''', '')
325
- # with open(f'{params["dir"]}/modules/ui.py', 'w') as writeFile:
326
- # writeFile.write(content)
327
 
328
  # 11.11 httpx依赖更新
329
  # 读取文件内容
 
305
  with open(f'{params["dir"]}/style.css', 'a') as cssFile:
306
  cssFile.write(css_content)
307
  # png_info脚本
308
+ if params["ui"] == "AUTOMATIC1111原版v1.5.1 and not os.path.exists(f'{params["dir"]}/extensions/adetailer')":
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)
312
+ # 拦截png_info
313
+ with open(f'{params["dir"]}/modules/ui.py', 'r') as readFile:
314
+ content = readFile.read()
315
+ content = content.replace(''' for tabname, button in buttons.items():
316
+ parameters_copypaste.register_paste_params_button(parameters_copypaste.ParamBinding(
317
+ paste_button=button, tabname=tabname, source_text_component=generation_info, source_image_component=image,
318
+ ))
319
 
320
+ image.change(
321
+ fn=wrap_gradio_call(modules.extras.run_pnginfo),
322
+ inputs=[image],
323
+ outputs=[html, generation_info, html2],
324
+ )''', '')
325
+ with open(f'{params["dir"]}/modules/ui.py', 'w') as writeFile:
326
+ writeFile.write(content)
327
 
328
  # 11.11 httpx依赖更新
329
  # 读取文件内容