From f741a98baccae100fcfb40c017b5c35c5cba1b0c Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Wed, 10 May 2023 08:43:42 +0300 Subject: imports cleanup for ruff --- scripts/prompts_from_file.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'scripts/prompts_from_file.py') diff --git a/scripts/prompts_from_file.py b/scripts/prompts_from_file.py index 76dc5778..149bc85f 100644 --- a/scripts/prompts_from_file.py +++ b/scripts/prompts_from_file.py @@ -1,6 +1,4 @@ import copy -import math -import os import random import sys import traceback @@ -11,8 +9,7 @@ import gradio as gr from modules import sd_samplers from modules.processing import Processed, process_images -from PIL import Image -from modules.shared import opts, cmd_opts, state +from modules.shared import state def process_string_tag(tag): -- cgit v1.2.1 From a5121e7a0623db328a9462d340d389ed6737374a Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Wed, 10 May 2023 11:37:18 +0300 Subject: fixes for B007 --- scripts/prompts_from_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/prompts_from_file.py') diff --git a/scripts/prompts_from_file.py b/scripts/prompts_from_file.py index 149bc85f..27af5ff6 100644 --- a/scripts/prompts_from_file.py +++ b/scripts/prompts_from_file.py @@ -156,7 +156,7 @@ class Script(scripts.Script): images = [] all_prompts = [] infotexts = [] - for n, args in enumerate(jobs): + for args in jobs: state.job = f"{state.job_no + 1} out of {state.job_count}" copy_p = copy.copy(p) -- cgit v1.2.1 From 483545252f865334a6da84339126cefd59c3d885 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Thu, 11 May 2023 14:24:22 +0300 Subject: fix broken prompts from file --- scripts/prompts_from_file.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts/prompts_from_file.py') diff --git a/scripts/prompts_from_file.py b/scripts/prompts_from_file.py index 27af5ff6..9607077a 100644 --- a/scripts/prompts_from_file.py +++ b/scripts/prompts_from_file.py @@ -97,11 +97,12 @@ def cmdargs(line): def load_prompt_file(file): if file is None: - lines = [] + return None, gr.update(), gr.update(lines=7) else: lines = [x.strip() for x in file.decode('utf8', errors='ignore').split("\n")] + return None, "\n".join(lines), gr.update(lines=7) + - return None, "\n".join(lines), gr.update(lines=7) class Script(scripts.Script): @@ -115,12 +116,12 @@ class Script(scripts.Script): prompt_txt = gr.Textbox(label="List of prompt inputs", lines=1, elem_id=self.elem_id("prompt_txt")) file = gr.File(label="Upload prompt inputs", type='binary', elem_id=self.elem_id("file")) - file.change(fn=load_prompt_file, inputs=[file], outputs=[file, prompt_txt, prompt_txt]) + file.change(fn=load_prompt_file, inputs=[file], outputs=[file, prompt_txt, prompt_txt], show_progress=False) # We start at one line. When the text changes, we jump to seven lines, or two lines if no \n. # We don't shrink back to 1, because that causes the control to ignore [enter], and it may # be unclear to the user that shift-enter is needed. - prompt_txt.change(lambda tb: gr.update(lines=7) if ("\n" in tb) else gr.update(lines=2), inputs=[prompt_txt], outputs=[prompt_txt]) + prompt_txt.change(lambda tb: gr.update(lines=7) if ("\n" in tb) else gr.update(lines=2), inputs=[prompt_txt], outputs=[prompt_txt], show_progress=False) return [checkbox_iterate, checkbox_iterate_batch, prompt_txt] def run(self, p, checkbox_iterate, checkbox_iterate_batch, prompt_txt: str): -- cgit v1.2.1 From 49a55b410b66b7dd9be9335d8a2e3a71e4f8b15c Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Thu, 11 May 2023 18:28:15 +0300 Subject: Autofix Ruff W (not W605) (mostly whitespace) --- scripts/prompts_from_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/prompts_from_file.py') diff --git a/scripts/prompts_from_file.py b/scripts/prompts_from_file.py index 9607077a..2378816f 100644 --- a/scripts/prompts_from_file.py +++ b/scripts/prompts_from_file.py @@ -109,7 +109,7 @@ class Script(scripts.Script): def title(self): return "Prompts from file or textbox" - def ui(self, is_img2img): + def ui(self, is_img2img): checkbox_iterate = gr.Checkbox(label="Iterate seed every line", value=False, elem_id=self.elem_id("checkbox_iterate")) checkbox_iterate_batch = gr.Checkbox(label="Use same random seed for all lines", value=False, elem_id=self.elem_id("checkbox_iterate_batch")) @@ -166,7 +166,7 @@ class Script(scripts.Script): proc = process_images(copy_p) images += proc.images - + if checkbox_iterate: p.seed = p.seed + (p.batch_size * p.n_iter) all_prompts += proc.all_prompts -- cgit v1.2.1 From d274b8297e8588ce1ea08200935e46c100288de3 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Thu, 11 May 2023 14:49:14 +0300 Subject: fix broken prompts from file --- scripts/prompts_from_file.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts/prompts_from_file.py') diff --git a/scripts/prompts_from_file.py b/scripts/prompts_from_file.py index 2378816f..b918a764 100644 --- a/scripts/prompts_from_file.py +++ b/scripts/prompts_from_file.py @@ -103,8 +103,6 @@ def load_prompt_file(file): return None, "\n".join(lines), gr.update(lines=7) - - class Script(scripts.Script): def title(self): return "Prompts from file or textbox" -- cgit v1.2.1