Sebastiankay commited on
Commit
41e2ba5
·
1 Parent(s): 7ba08ff

Sep 10, 2024, 2:28 PM

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -247,7 +247,14 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
247
 
248
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons, image_width, image_height], outputs=[image_width, image_height], show_progress="hidden")
249
 
250
- run_button.click(fn=process, inputs=[text_prompt, image_width, image_height, image_seed, randomize_seed], outputs=[output_image, output_url, outpu_image_comment, image_informations, image_info_tb_prompt, image_info_tb_width, image_info_tb_height, image_info_tb_seed, image_download_button, output_dominant_image_color, image_seed])
 
 
 
 
 
 
 
251
 
252
  enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt])
253
  random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt])
 
247
 
248
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons, image_width, image_height], outputs=[image_width, image_height], show_progress="hidden")
249
 
250
+ js_check_empty_prompt = """
251
+ function js_check_empty_prompt(x) {
252
+ if x === "" {
253
+ document.querySelector("#random_prompt_btn").click()
254
+ }
255
+ }
256
+ """
257
+ run_button.click(fn=None, inputs=text_prompt, outputs=None, js=js_check_empty_prompt).then(fn=process, inputs=[text_prompt, image_width, image_height, image_seed, randomize_seed], outputs=[output_image, output_url, outpu_image_comment, image_informations, image_info_tb_prompt, image_info_tb_width, image_info_tb_height, image_info_tb_seed, image_download_button, output_dominant_image_color, image_seed])
258
 
259
  enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt])
260
  random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt])