Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -68,11 +68,12 @@ def infer(
|
|
68 |
generator=generator,
|
69 |
).images[0]
|
70 |
|
71 |
-
# Save image as Base64
|
72 |
-
buffered = BytesIO()
|
73 |
-
image.save(buffered, format="PNG")
|
74 |
-
base64_image = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
75 |
-
return image, seed, f"data:image/png;base64,{base64_image}"
|
|
|
76 |
|
77 |
|
78 |
examples = ["murasame \(senren\), senren banka",]
|
@@ -101,7 +102,7 @@ with gr.Blocks() as img:
|
|
101 |
|
102 |
result = gr.Image(label="Result", show_label=False)
|
103 |
|
104 |
-
base64_view = gr.HTML(label="Base64 Image Preview", interactive=True)
|
105 |
|
106 |
with gr.Accordion("Advanced Settings", open=False):
|
107 |
negative_prompt = gr.Text(
|
@@ -173,18 +174,19 @@ with gr.Blocks() as img:
|
|
173 |
guidance_scale,
|
174 |
num_inference_steps,
|
175 |
],
|
176 |
-
outputs=[result, seed, base64_view],
|
|
|
177 |
)
|
178 |
|
179 |
-
# JavaScript logic to dynamically update HTML with Base64
|
180 |
-
js_script = """
|
181 |
-
<script>
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
</script>
|
186 |
-
"""
|
187 |
-
gr.HTML(js_script)
|
188 |
|
189 |
if __name__ == "__main__":
|
190 |
img.launch()
|
|
|
68 |
generator=generator,
|
69 |
).images[0]
|
70 |
|
71 |
+
# # Save image as Base64
|
72 |
+
# buffered = BytesIO()
|
73 |
+
# image.save(buffered, format="PNG")
|
74 |
+
# base64_image = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
75 |
+
# return image, seed, f"data:image/png;base64,{base64_image}"
|
76 |
+
return image, seed
|
77 |
|
78 |
|
79 |
examples = ["murasame \(senren\), senren banka",]
|
|
|
102 |
|
103 |
result = gr.Image(label="Result", show_label=False)
|
104 |
|
105 |
+
# base64_view = gr.HTML(label="Base64 Image Preview", interactive=True)
|
106 |
|
107 |
with gr.Accordion("Advanced Settings", open=False):
|
108 |
negative_prompt = gr.Text(
|
|
|
174 |
guidance_scale,
|
175 |
num_inference_steps,
|
176 |
],
|
177 |
+
# outputs=[result, seed, base64_view],
|
178 |
+
outputs=[result, seed],
|
179 |
)
|
180 |
|
181 |
+
# # JavaScript logic to dynamically update HTML with Base64
|
182 |
+
# js_script = """
|
183 |
+
# <script>
|
184 |
+
# function updateBase64(html_id, base64_src) {
|
185 |
+
# document.getElementById(html_id).innerHTML = `<img src="${base64_src}" alt="Generated Image"/>`;
|
186 |
+
# }
|
187 |
+
# </script>
|
188 |
+
# """
|
189 |
+
# gr.HTML(js_script)
|
190 |
|
191 |
if __name__ == "__main__":
|
192 |
img.launch()
|