Spaces:
Running
on
Zero
Running
on
Zero
修改文件格式为png
Browse files- __pycache__/config.cpython-310.pyc +0 -0
- __pycache__/utils.cpython-310.pyc +0 -0
- app.py +7 -4
__pycache__/config.cpython-310.pyc
CHANGED
Binary files a/__pycache__/config.cpython-310.pyc and b/__pycache__/config.cpython-310.pyc differ
|
|
__pycache__/utils.cpython-310.pyc
CHANGED
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -23,7 +23,7 @@ from config import (
|
|
23 |
DEFAULT_NEGATIVE_PROMPT,
|
24 |
scheduler_list,
|
25 |
)
|
26 |
-
|
27 |
|
28 |
MAX_SEED = np.iinfo(np.int32).max
|
29 |
|
@@ -176,9 +176,11 @@ def generate(
|
|
176 |
output_type="pil",
|
177 |
callback_on_step_end=callback2
|
178 |
).images
|
179 |
-
out_img = images[0]
|
180 |
-
|
181 |
-
|
|
|
|
|
182 |
except GenerationError as e:
|
183 |
logger.warning(f"Generation validation error: {str(e)}")
|
184 |
raise gr.Error(str(e))
|
@@ -305,6 +307,7 @@ with gr.Blocks(css=custom_css).queue() as demo:
|
|
305 |
with gr.Column():
|
306 |
gr.Markdown("### Output")
|
307 |
result = gr.Image(
|
|
|
308 |
label="Generated Image",
|
309 |
elem_id="output-image"
|
310 |
)
|
|
|
23 |
DEFAULT_NEGATIVE_PROMPT,
|
24 |
scheduler_list,
|
25 |
)
|
26 |
+
import io
|
27 |
|
28 |
MAX_SEED = np.iinfo(np.int32).max
|
29 |
|
|
|
176 |
output_type="pil",
|
177 |
callback_on_step_end=callback2
|
178 |
).images
|
179 |
+
out_img = images[0]
|
180 |
+
png_io = io.BytesIO()
|
181 |
+
out_img.save(png_io, format="PNG")
|
182 |
+
png_io.seek(0)
|
183 |
+
return Image.open(png_io)
|
184 |
except GenerationError as e:
|
185 |
logger.warning(f"Generation validation error: {str(e)}")
|
186 |
raise gr.Error(str(e))
|
|
|
307 |
with gr.Column():
|
308 |
gr.Markdown("### Output")
|
309 |
result = gr.Image(
|
310 |
+
image_mode="RGBA",
|
311 |
label="Generated Image",
|
312 |
elem_id="output-image"
|
313 |
)
|