Spaces:
Sleeping
Sleeping
Cagliostro
commited on
Commit
·
c2cfe45
1
Parent(s):
cd54846
Update app.py
Browse files
app.py
CHANGED
|
@@ -168,11 +168,12 @@ def generate(
|
|
| 168 |
output_type="pil",
|
| 169 |
).images[0]
|
| 170 |
|
| 171 |
-
if
|
|
|
|
| 172 |
filepath = utils.save_image(image, metadata, OUTPUT_DIR)
|
| 173 |
logger.info(f"Image saved as {filepath} with metadata")
|
| 174 |
|
| 175 |
-
return
|
| 176 |
except Exception as e:
|
| 177 |
logger.exception(f"An error occurred: {e}")
|
| 178 |
raise
|
|
@@ -316,7 +317,12 @@ with gr.Blocks(css="style.css", theme="NoCrypt/[email protected]") as demo:
|
|
| 316 |
with gr.Column(scale=3):
|
| 317 |
with gr.Blocks():
|
| 318 |
run_button = gr.Button("Generate", variant="primary")
|
| 319 |
-
result = gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
with gr.Accordion(label="Generation Parameters", open=False):
|
| 321 |
gr_metadata = gr.JSON(label="Metadata", show_label=False)
|
| 322 |
gr.Examples(
|
|
|
|
| 168 |
output_type="pil",
|
| 169 |
).images[0]
|
| 170 |
|
| 171 |
+
if images and IS_COLAB:
|
| 172 |
+
for image in images:
|
| 173 |
filepath = utils.save_image(image, metadata, OUTPUT_DIR)
|
| 174 |
logger.info(f"Image saved as {filepath} with metadata")
|
| 175 |
|
| 176 |
+
return images, metadata
|
| 177 |
except Exception as e:
|
| 178 |
logger.exception(f"An error occurred: {e}")
|
| 179 |
raise
|
|
|
|
| 317 |
with gr.Column(scale=3):
|
| 318 |
with gr.Blocks():
|
| 319 |
run_button = gr.Button("Generate", variant="primary")
|
| 320 |
+
result = gr.Gallery(
|
| 321 |
+
label="Result",
|
| 322 |
+
columns=1,
|
| 323 |
+
preview=True,
|
| 324 |
+
show_label=False
|
| 325 |
+
)
|
| 326 |
with gr.Accordion(label="Generation Parameters", open=False):
|
| 327 |
gr_metadata = gr.JSON(label="Metadata", show_label=False)
|
| 328 |
gr.Examples(
|