Spaces:
Runtime error
Runtime error
Treat a value of 0 as default
Browse files
app.py
CHANGED
@@ -34,6 +34,7 @@ def load_pipeline(model):
|
|
34 |
)
|
35 |
|
36 |
|
|
|
37 |
pipe = load_pipeline(DEFAULT_MODEL).to("cuda")
|
38 |
|
39 |
|
@@ -57,12 +58,17 @@ def infer(
|
|
57 |
# Downscale the image
|
58 |
init_image.thumbnail((1024, 1024))
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
images = pipe(
|
68 |
prompt=prompt,
|
@@ -70,8 +76,6 @@ def infer(
|
|
70 |
negative_prompt=negative_prompt,
|
71 |
width=width,
|
72 |
height=height,
|
73 |
-
num_inference_steps=num_inference_steps,
|
74 |
-
guidance_scale=guidance_scale,
|
75 |
**additional_args,
|
76 |
).images
|
77 |
return images[0]
|
@@ -139,10 +143,10 @@ with gr.Blocks(css=css) as demo:
|
|
139 |
|
140 |
num_inference_steps = gr.Slider(
|
141 |
label="Number of inference steps",
|
142 |
-
minimum=
|
143 |
maximum=100,
|
144 |
step=1,
|
145 |
-
value=
|
146 |
)
|
147 |
|
148 |
guidance_scale = gr.Slider(
|
|
|
34 |
)
|
35 |
|
36 |
|
37 |
+
logger.debug(f"Loading pipeline: {dict(model=model)}")
|
38 |
pipe = load_pipeline(DEFAULT_MODEL).to("cuda")
|
39 |
|
40 |
|
|
|
58 |
# Downscale the image
|
59 |
init_image.thumbnail((1024, 1024))
|
60 |
|
61 |
+
additional_args = {
|
62 |
+
k: v
|
63 |
+
for k, v in dict(
|
64 |
+
strength=strength,
|
65 |
+
num_inference_steps=num_inference_steps,
|
66 |
+
guidance_scale=guidance_scale,
|
67 |
+
).items()
|
68 |
+
if v
|
69 |
+
}
|
70 |
+
|
71 |
+
logger.debug(f"Generating image: {dict(prompt=prompt, **additional_args)}")
|
72 |
|
73 |
images = pipe(
|
74 |
prompt=prompt,
|
|
|
76 |
negative_prompt=negative_prompt,
|
77 |
width=width,
|
78 |
height=height,
|
|
|
|
|
79 |
**additional_args,
|
80 |
).images
|
81 |
return images[0]
|
|
|
143 |
|
144 |
num_inference_steps = gr.Slider(
|
145 |
label="Number of inference steps",
|
146 |
+
minimum=0,
|
147 |
maximum=100,
|
148 |
step=1,
|
149 |
+
value=0,
|
150 |
)
|
151 |
|
152 |
guidance_scale = gr.Slider(
|