Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fix share button
#826
by
mishig
HF Staff
- opened
- app.py +4 -4
- 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/
|
| 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
|
| 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")
|
|
|
|
| 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}}.
|
| 47 |
-
return new File([blob], fileName, { type: 'image/
|
| 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 |
|