Spaces:
Running on CPU Upgrade

multimodalart HF staff commited on
Commit
6997717
1 Parent(s): a623873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -25,7 +25,7 @@ def infer(prompt, negative="low_quality", scale=7):
25
  image_b64 = (f"data:image/jpeg;base64,{image}")
26
  images.append(image_b64)
27
 
28
- return images
29
 
30
 
31
  css = """
@@ -252,7 +252,7 @@ with block:
252
  )
253
 
254
 
255
- with gr.Group(elem_id="share-btn-container"):
256
  community_icon = gr.HTML(community_icon_html)
257
  loading_icon = gr.HTML(loading_icon_html)
258
  share_button = gr.Button("Share to community", elem_id="share-btn")
@@ -269,11 +269,10 @@ with block:
269
  label="Guidance Scale", minimum=0, maximum=50, value=9, step=0.1
270
  )
271
 
272
- ex = gr.Examples(examples=examples, fn=infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_icon, loading_icon, share_button], cache_examples=False)
273
- #ex.dataset.headers = [""]
274
- negative.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
275
- text.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
276
- btn.click(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
277
 
278
  share_button.click(
279
  None,
 
25
  image_b64 = (f"data:image/jpeg;base64,{image}")
26
  images.append(image_b64)
27
 
28
+ return images, gr.update(visible=True)
29
 
30
 
31
  css = """
 
252
  )
253
 
254
 
255
+ with gr.Group(elem_id="share-btn-container", visible=False) as community_group:
256
  community_icon = gr.HTML(community_icon_html)
257
  loading_icon = gr.HTML(loading_icon_html)
258
  share_button = gr.Button("Share to community", elem_id="share-btn")
 
269
  label="Guidance Scale", minimum=0, maximum=50, value=9, step=0.1
270
  )
271
 
272
+ ex = gr.Examples(examples=examples, fn=infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_group], cache_examples=True)
273
+ negative.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_group], postprocess=False)
274
+ text.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_group], postprocess=False)
275
+ btn.click(infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_group], postprocess=False)
 
276
 
277
  share_button.click(
278
  None,