mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-19 21:00:14 +08:00
update token counter when clearing prompt
This commit is contained in:
parent
ee0505dd00
commit
de70ddaf58
@ -162,7 +162,7 @@ function selected_tab_id() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function trash_prompt(_, confirmed) {
|
function trash_prompt(_, confirmed,_steps) {
|
||||||
|
|
||||||
if(confirm("Delete prompt?")) {
|
if(confirm("Delete prompt?")) {
|
||||||
confirmed = true
|
confirmed = true
|
||||||
@ -176,7 +176,7 @@ return [_, confirmed]
|
|||||||
update_token_counter("txt2img_token_button")
|
update_token_counter("txt2img_token_button")
|
||||||
}
|
}
|
||||||
|
|
||||||
return [_, confirmed]
|
return [_, confirmed,_steps]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,19 +430,16 @@ def create_seed_inputs():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def connect_trash_prompt(_, confirmed):
|
def connect_trash_prompt(_prompt, confirmed, _token_counter):
|
||||||
if(confirmed):
|
if(confirmed):
|
||||||
# update_token_counter(prompt, steps)
|
return ["", confirmed, update_token_counter("", 1)]
|
||||||
return ["", confirmed]
|
|
||||||
|
|
||||||
def trash_prompt_click(button, prompt):
|
|
||||||
dummy_component = gradio.Label(visible=False)
|
|
||||||
|
|
||||||
|
def trash_prompt_click(button, prompt, _dummy_confirmed, token_counter):
|
||||||
button.click(
|
button.click(
|
||||||
_js="trash_prompt",
|
_js="trash_prompt",
|
||||||
fn=connect_trash_prompt,
|
fn=connect_trash_prompt,
|
||||||
inputs=[prompt, dummy_component],
|
inputs=[prompt, _dummy_confirmed, token_counter],
|
||||||
outputs=[prompt, dummy_component],
|
outputs=[prompt, _dummy_confirmed, token_counter],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -649,7 +646,6 @@ def create_ui(wrap_gradio_gpu_call):
|
|||||||
txt_prompt_img = gr.File(label="", elem_id="txt2img_prompt_image", file_count="single", type="bytes", visible=False)
|
txt_prompt_img = gr.File(label="", elem_id="txt2img_prompt_image", file_count="single", type="bytes", visible=False)
|
||||||
|
|
||||||
|
|
||||||
trash_prompt_click(trash_prompt_button, txt2img_prompt)
|
|
||||||
|
|
||||||
|
|
||||||
with gr.Row(elem_id='txt2img_progress_row'):
|
with gr.Row(elem_id='txt2img_progress_row'):
|
||||||
@ -720,6 +716,7 @@ def create_ui(wrap_gradio_gpu_call):
|
|||||||
|
|
||||||
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
|
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
|
||||||
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
|
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
|
||||||
|
trash_prompt_click(trash_prompt_button, txt2img_prompt, dummy_component, token_counter)
|
||||||
|
|
||||||
txt2img_args = dict(
|
txt2img_args = dict(
|
||||||
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img),
|
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img),
|
||||||
@ -858,7 +855,6 @@ def create_ui(wrap_gradio_gpu_call):
|
|||||||
img2img_interrogate, img2img_deepbooru, img2img_prompt_style_apply, img2img_save_style, img2img_paste,\
|
img2img_interrogate, img2img_deepbooru, img2img_prompt_style_apply, img2img_save_style, img2img_paste,\
|
||||||
token_counter, token_button, trash_prompt_button = create_toprow(is_img2img=True)
|
token_counter, token_button, trash_prompt_button = create_toprow(is_img2img=True)
|
||||||
|
|
||||||
trash_prompt_click(trash_prompt_button, img2img_prompt)
|
|
||||||
|
|
||||||
with gr.Row(elem_id='img2img_progress_row'):
|
with gr.Row(elem_id='img2img_progress_row'):
|
||||||
img2img_prompt_img = gr.File(label="", elem_id="img2img_prompt_image", file_count="single", type="bytes", visible=False)
|
img2img_prompt_img = gr.File(label="", elem_id="img2img_prompt_image", file_count="single", type="bytes", visible=False)
|
||||||
@ -958,6 +954,7 @@ def create_ui(wrap_gradio_gpu_call):
|
|||||||
|
|
||||||
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
|
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
|
||||||
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
|
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
|
||||||
|
trash_prompt_click(trash_prompt_button, img2img_prompt, dummy_component, token_counter)
|
||||||
|
|
||||||
img2img_prompt_img.change(
|
img2img_prompt_img.change(
|
||||||
fn=modules.images.image_data,
|
fn=modules.images.image_data,
|
||||||
|
Loading…
Reference in New Issue
Block a user