Sebastiankay commited on
Commit
c711d64
1 Parent(s): 8c10452

Sep 10, 2024, 3:26 PM

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -205,6 +205,7 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
205
  output_url = gr.Textbox(label="Output URL", show_label=True, interactive=False, visible=False)
206
  outpu_image_comment = gr.Json(visible=False)
207
  output_dominant_image_color = gr.Textbox(show_label=False, elem_id="dominant_image_color", visible=True, elem_classes="output-dominant-image-color")
 
208
 
209
  def switch_image_size_values(image_width, image_height):
210
  return image_height, image_width
@@ -247,14 +248,7 @@ 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
- js_check_empty_prompt = """
251
- function js_check_empty_prompt() {
252
- if document.querySelector("#prompt_input > label > textarea").value === "" {
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])
 
205
  output_url = gr.Textbox(label="Output URL", show_label=True, interactive=False, visible=False)
206
  outpu_image_comment = gr.Json(visible=False)
207
  output_dominant_image_color = gr.Textbox(show_label=False, elem_id="dominant_image_color", visible=True, elem_classes="output-dominant-image-color")
208
+ random_promp_output = gr.Textbox(show_label=False, elem_id="random_promp_output", elem_classes="random_promp_output", visible=True, interactive=False)
209
 
210
  def switch_image_size_values(image_width, image_height):
211
  return image_height, image_width
 
248
 
249
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons, image_width, image_height], outputs=[image_width, image_height], show_progress="hidden")
250
 
251
+ 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, random_promp_output])
 
 
 
 
 
 
 
252
 
253
  enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt])
254
  random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt])