diff --git a/javascript/ui.js b/javascript/ui.js index 1eef6d33799..c0ee607ffd0 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -384,16 +384,6 @@ function updateImg2imgResizeToTextAfterChangingImage() { } - -function setRandomSeed(elem_id) { - var input = gradioApp().querySelector("#" + elem_id + " input"); - if (!input) return []; - - input.value = "-1"; - updateInput(input); - return []; -} - function switchWidthHeight(tabname) { var width = gradioApp().querySelector("#" + tabname + "_width input[type=number]"); var height = gradioApp().querySelector("#" + tabname + "_height input[type=number]"); diff --git a/modules/processing_scripts/seed.py b/modules/processing_scripts/seed.py index 7a4c0159831..ac684a75ba5 100644 --- a/modules/processing_scripts/seed.py +++ b/modules/processing_scripts/seed.py @@ -47,8 +47,8 @@ def ui(self, is_img2img): seed_resize_from_w = gr.Slider(minimum=0, maximum=2048, step=8, label="Resize seed from width", value=0, elem_id=self.elem_id("seed_resize_from_w")) seed_resize_from_h = gr.Slider(minimum=0, maximum=2048, step=8, label="Resize seed from height", value=0, elem_id=self.elem_id("seed_resize_from_h")) - random_seed.click(fn=None, _js="function(){setRandomSeed('" + self.elem_id("seed") + "')}", show_progress=False, inputs=[], outputs=[]) - random_subseed.click(fn=None, _js="function(){setRandomSeed('" + self.elem_id("subseed") + "')}", show_progress=False, inputs=[], outputs=[]) + random_seed.click(fn=lambda: "" if cmd_opts.use_textbox_seed else -1, show_progress=False, outputs=[self.seed]) + random_subseed.click(fn=lambda: -1, show_progress=False, outputs=[subseed]) seed_checkbox.change(lambda x: gr.update(visible=x), show_progress=False, inputs=[seed_checkbox], outputs=[seed_extras])