Fix for Prompts_from_file showing extra textbox.

This commit is contained in:
Tony Beeman
2022-10-07 17:46:39 -07:00
committed by AUTOMATIC1111
parent 1ffeb42d38
commit e2930f9821
2 changed files with 30 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ from modules.processing import Processed, process_images
from PIL import Image
from modules.shared import opts, cmd_opts, state
g_txt_mode = False
class Script(scripts.Script):
def title(self):
@@ -29,6 +30,9 @@ class Script(scripts.Script):
checkbox_txt.change(fn=lambda x: [gr.File.update(visible = not x), gr.TextArea.update(visible = x)], inputs=[checkbox_txt], outputs=[file, prompt_txt])
return [checkbox_txt, file, prompt_txt]
def on_show(self, checkbox_txt, file, prompt_txt):
return [ gr.Checkbox.update(visible = True), gr.File.update(visible = not checkbox_txt), gr.TextArea.update(visible = checkbox_txt) ]
def run(self, p, checkbox_txt, data: bytes, prompt_txt: str):
if (checkbox_txt):
lines = [x.strip() for x in prompt_txt.splitlines()]