Spaces:
Runtime error
Runtime error
Remove sample size argument
Browse files
app.py
CHANGED
@@ -29,11 +29,13 @@ current_image_size = 256
|
|
29 |
current_vae_model = "stabilityai/sd-vae-ft-mse"
|
30 |
|
31 |
|
32 |
-
def generate(image_size, vae_model, class_label, cfg_scale, num_sampling_steps,
|
|
|
33 |
image_size = int(image_size.split("x")[0])
|
34 |
global current_image_size
|
35 |
if image_size != current_image_size:
|
36 |
global model
|
|
|
37 |
del model
|
38 |
if device == "cuda":
|
39 |
torch.cuda.empty_cache()
|
@@ -126,15 +128,15 @@ with gr.Blocks() as demo:
|
|
126 |
)
|
127 |
cfg_scale = gr.inputs.Slider(minimum=1, maximum=25, step=0.1, default=4.0, label='Classifier-free Guidance Scale')
|
128 |
steps = gr.inputs.Slider(minimum=4, maximum=1000, step=1, default=75, label='Sampling Steps')
|
129 |
-
n = gr.inputs.Slider(minimum=1, maximum=16, step=1, default=1, label='Number of Samples')
|
130 |
seed = gr.inputs.Number(default=0, label='Seed')
|
131 |
button = gr.Button("Generate", variant="primary")
|
132 |
with gr.Column():
|
133 |
output = gr.Gallery(label='Generated Images').style(grid=[2], height="auto")
|
134 |
-
button.click(generate, inputs=[image_size, vae_model, i1k_class, cfg_scale, steps,
|
135 |
with gr.Row():
|
136 |
ex = gr.Examples(examples=examples, fn=generate,
|
137 |
-
inputs=[image_size, vae_model, i1k_class, cfg_scale, steps,
|
138 |
outputs=[output],
|
139 |
cache_examples=True)
|
140 |
|
|
|
29 |
current_vae_model = "stabilityai/sd-vae-ft-mse"
|
30 |
|
31 |
|
32 |
+
def generate(image_size, vae_model, class_label, cfg_scale, num_sampling_steps, seed):
|
33 |
+
n = 1
|
34 |
image_size = int(image_size.split("x")[0])
|
35 |
global current_image_size
|
36 |
if image_size != current_image_size:
|
37 |
global model
|
38 |
+
model = model.to("cpu")
|
39 |
del model
|
40 |
if device == "cuda":
|
41 |
torch.cuda.empty_cache()
|
|
|
128 |
)
|
129 |
cfg_scale = gr.inputs.Slider(minimum=1, maximum=25, step=0.1, default=4.0, label='Classifier-free Guidance Scale')
|
130 |
steps = gr.inputs.Slider(minimum=4, maximum=1000, step=1, default=75, label='Sampling Steps')
|
131 |
+
# n = gr.inputs.Slider(minimum=1, maximum=16, step=1, default=1, label='Number of Samples')
|
132 |
seed = gr.inputs.Number(default=0, label='Seed')
|
133 |
button = gr.Button("Generate", variant="primary")
|
134 |
with gr.Column():
|
135 |
output = gr.Gallery(label='Generated Images').style(grid=[2], height="auto")
|
136 |
+
button.click(generate, inputs=[image_size, vae_model, i1k_class, cfg_scale, steps, seed], outputs=[output])
|
137 |
with gr.Row():
|
138 |
ex = gr.Examples(examples=examples, fn=generate,
|
139 |
+
inputs=[image_size, vae_model, i1k_class, cfg_scale, steps, seed],
|
140 |
outputs=[output],
|
141 |
cache_examples=True)
|
142 |
|