Sebastiankay commited on
Commit
9500f5b
1 Parent(s): fe4060c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -50,6 +50,7 @@ custom_head = f"""
50
  <link rel="icon" type="image/png" sizes="16x16" href="file=_res/assets/favicons/favicon-16x16.png">
51
  <link rel="icon" type="image/x-icon" href="file=_res/assets/favicons/favicon.ico">
52
  <link rel="manifest" href="file=_res/assets/favicons/site.webmanifest">
 
53
  """
54
 
55
  theme = gr.themes.Soft(
@@ -326,9 +327,9 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
326
 
327
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons], outputs=[image_ratio_buttons, image_width, image_height], show_progress="hidden", show_api=False)
328
 
329
- run_button.click(fn=lambda: ({"interactive": False, "__type__": "update"}, {"interactive": False, "__type__": "update"}, {"interactive": False, "__type__": "update"}), outputs=[run_button, enhance_prompt_button, random_prompt_button], show_api=False).then(fn=clear_components, outputs=[output_image], show_api=False).then(
330
  fn=process, inputs=[text_prompt, select_model, image_width, image_height, image_ratio_buttons, image_seed, randomize_seed], outputs=[text_prompt, output_image, output_url, 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]
331
- ).then(fn=lambda: ({"interactive": True, "__type__": "update"}, {"interactive": True, "__type__": "update"}, {"interactive": True, "__type__": "update"}), outputs=[run_button, enhance_prompt_button, random_prompt_button], show_api=False)
332
 
333
  randomize_seed.input(lambda x: {"interactive": False if x == True else True, "__type__": "update"}, inputs=[randomize_seed], outputs=[image_seed], show_api=False)
334
 
 
50
  <link rel="icon" type="image/png" sizes="16x16" href="file=_res/assets/favicons/favicon-16x16.png">
51
  <link rel="icon" type="image/x-icon" href="file=_res/assets/favicons/favicon.ico">
52
  <link rel="manifest" href="file=_res/assets/favicons/site.webmanifest">
53
+ <script src="https://unpkg.com/@dotlottie/player-component@latest/dist/dotlottie-player.mjs" type="module"></script>
54
  """
55
 
56
  theme = gr.themes.Soft(
 
327
 
328
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons], outputs=[image_ratio_buttons, image_width, image_height], show_progress="hidden", show_api=False)
329
 
330
+ run_button.click(fn=lambda: ({"interactive": False, "__type__": "update"}, {"interactive": False, "__type__": "update"}, {"interactive": False, "__type__": "update"}), outputs=[run_button, enhance_prompt_button, random_prompt_button], show_api=False, js="() => document.querySelector('dotlottie-player').play()").then(fn=clear_components, outputs=[output_image], show_api=False).then(
331
  fn=process, inputs=[text_prompt, select_model, image_width, image_height, image_ratio_buttons, image_seed, randomize_seed], outputs=[text_prompt, output_image, output_url, 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]
332
+ ).then(fn=lambda: ({"interactive": True, "__type__": "update"}, {"interactive": True, "__type__": "update"}, {"interactive": True, "__type__": "update"}), outputs=[run_button, enhance_prompt_button, random_prompt_button], show_api=False, js="() => document.querySelector('dotlottie-player').stop()")
333
 
334
  randomize_seed.input(lambda x: {"interactive": False if x == True else True, "__type__": "update"}, inputs=[randomize_seed], outputs=[image_seed], show_api=False)
335