Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,19 +45,20 @@ def generate(prompt, steps, guidance, seed, model_name):
|
|
| 45 |
pipe = get_pipeline(model_id)
|
| 46 |
generator = None if int(seed) == 0 else torch.manual_seed(int(seed))
|
| 47 |
|
| 48 |
-
# Ensure
|
| 49 |
output = pipe(
|
| 50 |
prompt=prompt,
|
| 51 |
num_inference_steps=int(steps),
|
| 52 |
guidance_scale=float(guidance),
|
| 53 |
generator=generator,
|
| 54 |
cross_attention_kwargs={},
|
|
|
|
| 55 |
)
|
| 56 |
return output.images
|
| 57 |
|
| 58 |
# Build the Gradio UI
|
| 59 |
with gr.Blocks() as demo:
|
| 60 |
-
gr.Markdown("## Model-Switcher Stable Diffusion Demo")
|
| 61 |
prompt = gr.Textbox(label="Prompt", value="Retro robot in neon city")
|
| 62 |
checkpoint = gr.Dropdown(choices=list(MODEL_OPTS.keys()),
|
| 63 |
value="SD v1.5 (base)",
|
|
|
|
| 45 |
pipe = get_pipeline(model_id)
|
| 46 |
generator = None if int(seed) == 0 else torch.manual_seed(int(seed))
|
| 47 |
|
| 48 |
+
# Ensure added_cond_kwargs is always a dict to avoid NoneType errors
|
| 49 |
output = pipe(
|
| 50 |
prompt=prompt,
|
| 51 |
num_inference_steps=int(steps),
|
| 52 |
guidance_scale=float(guidance),
|
| 53 |
generator=generator,
|
| 54 |
cross_attention_kwargs={},
|
| 55 |
+
added_cond_kwargs={},
|
| 56 |
)
|
| 57 |
return output.images
|
| 58 |
|
| 59 |
# Build the Gradio UI
|
| 60 |
with gr.Blocks() as demo:
|
| 61 |
+
gr.Markdown("## ✨ Model-Switcher Stable Diffusion Demo")
|
| 62 |
prompt = gr.Textbox(label="Prompt", value="Retro robot in neon city")
|
| 63 |
checkpoint = gr.Dropdown(choices=list(MODEL_OPTS.keys()),
|
| 64 |
value="SD v1.5 (base)",
|