Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
•
0b3c370
1
Parent(s):
49bc296
steps
Browse files
app.py
CHANGED
@@ -53,7 +53,7 @@ NUM_INFERENCE_STEPS = 4
|
|
53 |
|
54 |
|
55 |
#@spaces.GPU
|
56 |
-
def infer(prompt, seed, randomize_seed):
|
57 |
if randomize_seed:
|
58 |
seed = random.randint(0, MAX_SEED)
|
59 |
|
@@ -62,7 +62,7 @@ def infer(prompt, seed, randomize_seed):
|
|
62 |
image = pipe(
|
63 |
prompt=prompt,
|
64 |
guidance_scale=0,
|
65 |
-
num_inference_steps=
|
66 |
generator=generator,
|
67 |
).images[0]
|
68 |
|
@@ -100,7 +100,7 @@ with gr.Blocks(css=css) as demo:
|
|
100 |
# # ⚡ Flash Diffusion: FlashPixart ⚡
|
101 |
# This is an interactive demo of [Flash Diffusion](https://gojasper.github.io/flash-diffusion-project/), a diffusion distillation method proposed in [Flash Diffusion: Accelerating Any Conditional
|
102 |
# Diffusion Model for Few Steps Image Generation](http://arxiv.org/abs/2406.02347) *by Clément Chadebec, Onur Tasar, Eyal Benaroche and Benjamin Aubin.*
|
103 |
-
# [This model](https://huggingface.co/jasperai/flash-pixart) is a **66.5M** LoRA distilled version of [Pixart-α](https://huggingface.co/PixArt-alpha/PixArt-XL-2-1024-MS) model that is able to generate 1024x1024 images in **4 steps**.
|
104 |
# Currently running on {power_device}.
|
105 |
# """
|
106 |
# )
|
@@ -132,6 +132,12 @@ with gr.Blocks(css=css) as demo:
|
|
132 |
step=1,
|
133 |
value=0,
|
134 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
137 |
|
@@ -144,7 +150,7 @@ with gr.Blocks(css=css) as demo:
|
|
144 |
gr.on(
|
145 |
[run_button.click, seed.change, randomize_seed.change, prompt.submit],
|
146 |
fn=infer,
|
147 |
-
inputs=[prompt, seed, randomize_seed],
|
148 |
outputs=[result],
|
149 |
show_progress="minimal",
|
150 |
show_api=False,
|
|
|
53 |
|
54 |
|
55 |
#@spaces.GPU
|
56 |
+
def infer(prompt, steps, seed, randomize_seed):
|
57 |
if randomize_seed:
|
58 |
seed = random.randint(0, MAX_SEED)
|
59 |
|
|
|
62 |
image = pipe(
|
63 |
prompt=prompt,
|
64 |
guidance_scale=0,
|
65 |
+
num_inference_steps=steps,
|
66 |
generator=generator,
|
67 |
).images[0]
|
68 |
|
|
|
100 |
# # ⚡ Flash Diffusion: FlashPixart ⚡
|
101 |
# This is an interactive demo of [Flash Diffusion](https://gojasper.github.io/flash-diffusion-project/), a diffusion distillation method proposed in [Flash Diffusion: Accelerating Any Conditional
|
102 |
# Diffusion Model for Few Steps Image Generation](http://arxiv.org/abs/2406.02347) *by Clément Chadebec, Onur Tasar, Eyal Benaroche and Benjamin Aubin.*
|
103 |
+
# [This model](https://huggingface.co/jasperai/flash-pixart) is a **66.5M** LoRA distilled version of [Pixart-α](https://huggingface.co/PixArt-alpha/PixArt-XL-2-1024-MS) model that is able to generate 1024x1024 images in **4 steps**.
|
104 |
# Currently running on {power_device}.
|
105 |
# """
|
106 |
# )
|
|
|
132 |
step=1,
|
133 |
value=0,
|
134 |
)
|
135 |
+
steps = gr.Number(
|
136 |
+
label="Steps",
|
137 |
+
minimum=1,
|
138 |
+
step=1,
|
139 |
+
value=4
|
140 |
+
)
|
141 |
|
142 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
143 |
|
|
|
150 |
gr.on(
|
151 |
[run_button.click, seed.change, randomize_seed.change, prompt.submit],
|
152 |
fn=infer,
|
153 |
+
inputs=[prompt, steps, seed, randomize_seed],
|
154 |
outputs=[result],
|
155 |
show_progress="minimal",
|
156 |
show_api=False,
|