Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -398,7 +398,6 @@ def generate(
|
|
| 398 |
steps=9,
|
| 399 |
shift=3.0,
|
| 400 |
random_seed=True,
|
| 401 |
-
gallery_images=None,
|
| 402 |
enhance=False,
|
| 403 |
progress=gr.Progress(track_tqdm=True),
|
| 404 |
):
|
|
@@ -416,13 +415,11 @@ def generate(
|
|
| 416 |
steps (int): Number of inference steps for the diffusion process
|
| 417 |
shift (float): Time shift parameter for the flow matching scheduler
|
| 418 |
random_seed (bool): Whether to generate a new random seed, if True will ignore the seed input
|
| 419 |
-
gallery_images (list): List of previously generated images to append to (only needed for the Gradio UI)
|
| 420 |
enhance (bool): This was Whether to enhance the prompt (DISABLED! Do not use)
|
| 421 |
progress (gr.Progress): Gradio progress tracker for displaying generation progress (only needed for the Gradio UI)
|
| 422 |
|
| 423 |
Returns:
|
| 424 |
tuple: (gallery_images, seed_str, seed_int)
|
| 425 |
-
- gallery_images: Updated list of generated images including the new image
|
| 426 |
- seed_str: String representation of the seed used for generation
|
| 427 |
- seed_int: Integer representation of the seed used for generation
|
| 428 |
"""
|
|
@@ -479,12 +476,8 @@ def generate(
|
|
| 479 |
except UnsafeContentError:
|
| 480 |
image = Image.open("nsfw.png")
|
| 481 |
|
| 482 |
-
if gallery_images is None:
|
| 483 |
-
gallery_images = []
|
| 484 |
-
# gallery_images.append(image)
|
| 485 |
-
gallery_images = [image] + gallery_images # latest output to be at the top of the list
|
| 486 |
|
| 487 |
-
return
|
| 488 |
|
| 489 |
|
| 490 |
init_app()
|
|
@@ -568,8 +561,8 @@ with gr.Blocks(title="Z-Image Demo") as demo:
|
|
| 568 |
|
| 569 |
generate_btn.click(
|
| 570 |
generate,
|
| 571 |
-
inputs=[prompt_input, resolution, seed, steps, shift, random_seed
|
| 572 |
-
outputs=[
|
| 573 |
api_visibility="public",
|
| 574 |
)
|
| 575 |
|
|
|
|
| 398 |
steps=9,
|
| 399 |
shift=3.0,
|
| 400 |
random_seed=True,
|
|
|
|
| 401 |
enhance=False,
|
| 402 |
progress=gr.Progress(track_tqdm=True),
|
| 403 |
):
|
|
|
|
| 415 |
steps (int): Number of inference steps for the diffusion process
|
| 416 |
shift (float): Time shift parameter for the flow matching scheduler
|
| 417 |
random_seed (bool): Whether to generate a new random seed, if True will ignore the seed input
|
|
|
|
| 418 |
enhance (bool): This was Whether to enhance the prompt (DISABLED! Do not use)
|
| 419 |
progress (gr.Progress): Gradio progress tracker for displaying generation progress (only needed for the Gradio UI)
|
| 420 |
|
| 421 |
Returns:
|
| 422 |
tuple: (gallery_images, seed_str, seed_int)
|
|
|
|
| 423 |
- seed_str: String representation of the seed used for generation
|
| 424 |
- seed_int: Integer representation of the seed used for generation
|
| 425 |
"""
|
|
|
|
| 476 |
except UnsafeContentError:
|
| 477 |
image = Image.open("nsfw.png")
|
| 478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
|
| 480 |
+
return image, str(new_seed), int(new_seed)
|
| 481 |
|
| 482 |
|
| 483 |
init_app()
|
|
|
|
| 561 |
|
| 562 |
generate_btn.click(
|
| 563 |
generate,
|
| 564 |
+
inputs=[prompt_input, resolution, seed, steps, shift, random_seed],
|
| 565 |
+
outputs=[image, used_seed, seed],
|
| 566 |
api_visibility="public",
|
| 567 |
)
|
| 568 |
|