multimodalart HF staff commited on
Commit
4430cec
1 Parent(s): 95d9369

Add share to community

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -11,6 +11,7 @@ from diffusers import (
11
  DPMSolverMultistepScheduler, # <-- Added import
12
  EulerDiscreteScheduler # <-- Added import
13
  )
 
14
 
15
  BASE_MODEL = "SG161222/Realistic_Vision_V5.1_noVAE"
16
 
@@ -87,7 +88,7 @@ def inference(
87
  #output_type="latent"
88
  ).images[0]
89
 
90
- return out
91
 
92
  with gr.Blocks() as app:
93
  gr.Markdown(
@@ -119,13 +120,17 @@ with gr.Blocks() as app:
119
  run_btn = gr.Button("Run")
120
  with gr.Column():
121
  result_image = gr.Image(label="Illusion Diffusion Output")
 
 
 
 
122
 
123
  run_btn.click(
124
  inference,
125
  inputs=[control_image, prompt, negative_prompt, guidance_scale, controlnet_conditioning_scale, seed, sampler],
126
- outputs=[result_image]
127
  )
128
-
129
  app.queue(max_size=20)
130
 
131
  if __name__ == "__main__":
 
11
  DPMSolverMultistepScheduler, # <-- Added import
12
  EulerDiscreteScheduler # <-- Added import
13
  )
14
+ from share_btn import community_icon_html, loading_icon_html, share_js
15
 
16
  BASE_MODEL = "SG161222/Realistic_Vision_V5.1_noVAE"
17
 
 
88
  #output_type="latent"
89
  ).images[0]
90
 
91
+ return out, gr.update(visible=True)
92
 
93
  with gr.Blocks() as app:
94
  gr.Markdown(
 
120
  run_btn = gr.Button("Run")
121
  with gr.Column():
122
  result_image = gr.Image(label="Illusion Diffusion Output")
123
+ with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
124
+ community_icon = gr.HTML(community_icon_html)
125
+ loading_icon = gr.HTML(loading_icon_html)
126
+ share_button = gr.Button("Share to community", elem_id="share-btn")
127
 
128
  run_btn.click(
129
  inference,
130
  inputs=[control_image, prompt, negative_prompt, guidance_scale, controlnet_conditioning_scale, seed, sampler],
131
+ outputs=[result_image, share_button]
132
  )
133
+ share_button.click(None, [], [], _js=share_js)
134
  app.queue(max_size=20)
135
 
136
  if __name__ == "__main__":