multimodalart HF staff mishig HF staff commited on
Commit
517a59b
1 Parent(s): 52ccb61

Fix share button (#826)

Browse files

- Fix share button (f8ff1400d4741b14a3d31ca8c0a8246d8d33023c)
- Revert dev change (9a3a78824f0a793f7046cd3d16bb5918f47039f1)
- png -> jpeg (3f24cd0fa4d92f6bd3cd535234ba36dd23073d99)
- Share btn visible all the time (5339e23612b9dec3181eb922dcb7b5b8563bf27b)


Co-authored-by: Mishig Davaadorj <mishig@users.noreply.huggingface.co>

Files changed (2) hide show
  1. app.py +4 -4
  2. share_btn.py +2 -2
app.py CHANGED
@@ -59,7 +59,7 @@ def infer(prompt):
59
  payload = {'prompt': prompt}
60
  images_request = requests.post(url, json = payload)
61
  for image in images_request.json()["images"]:
62
- image_b64 = (f"data:image/png;base64,{image}")
63
  images.append(image_b64)
64
 
65
  return images
@@ -313,9 +313,9 @@ with block:
313
  with gr.Group(elem_id="container-advanced-btns"):
314
  advanced_button = gr.Button("Advanced options", elem_id="advanced-btn")
315
  with gr.Group(elem_id="share-btn-container"):
316
- community_icon = gr.HTML(community_icon_html, visible=False)
317
- loading_icon = gr.HTML(loading_icon_html, visible=False)
318
- share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
319
 
320
  with gr.Row(elem_id="advanced-options"):
321
  gr.Markdown("Advanced settings are temporarily unavailable")
 
59
  payload = {'prompt': prompt}
60
  images_request = requests.post(url, json = payload)
61
  for image in images_request.json()["images"]:
62
+ image_b64 = (f"data:image/jpeg;base64,{image}")
63
  images.append(image_b64)
64
 
65
  return images
 
313
  with gr.Group(elem_id="container-advanced-btns"):
314
  advanced_button = gr.Button("Advanced options", elem_id="advanced-btn")
315
  with gr.Group(elem_id="share-btn-container"):
316
+ community_icon = gr.HTML(community_icon_html)
317
+ loading_icon = gr.HTML(loading_icon_html)
318
+ share_button = gr.Button("Share to community", elem_id="share-btn")
319
 
320
  with gr.Row(elem_id="advanced-options"):
321
  gr.Markdown("Advanced settings are temporarily unavailable")
share_btn.py CHANGED
@@ -43,8 +43,8 @@ share_js = """async () => {
43
  const res = await fetch(imgEl.src);
44
  const blob = await res.blob();
45
  const imgId = Date.now() % 200;
46
- const fileName = `diffuse-the-rest-${{imgId}}.png`;
47
- return new File([blob], fileName, { type: 'image/png' });
48
  })
49
  );
50
 
 
43
  const res = await fetch(imgEl.src);
44
  const blob = await res.blob();
45
  const imgId = Date.now() % 200;
46
+ const fileName = `diffuse-the-rest-${{imgId}}.jpg`;
47
+ return new File([blob], fileName, { type: 'image/jpeg' });
48
  })
49
  );
50