Spaces:
Paused
Paused
nykadamec commited on
Commit ·
d2b6d64
1
Parent(s): 3c0773e
fix: convert steps and guidance_scale to proper types
Browse files
app.py
CHANGED
|
@@ -104,6 +104,18 @@ def generate(
|
|
| 104 |
print(f"LoRA loading failed: {error_msg}")
|
| 105 |
current_lora = None
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
# Set scheduler
|
| 108 |
if scheduler == "EulerDiscrete":
|
| 109 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
|
@@ -122,8 +134,8 @@ def generate(
|
|
| 122 |
result = pipe(
|
| 123 |
prompt=prompt,
|
| 124 |
negative_prompt=negative_prompt if negative_prompt else None,
|
| 125 |
-
num_inference_steps=
|
| 126 |
-
guidance_scale=
|
| 127 |
width=width,
|
| 128 |
height=height,
|
| 129 |
generator=generator,
|
|
|
|
| 104 |
print(f"LoRA loading failed: {error_msg}")
|
| 105 |
current_lora = None
|
| 106 |
|
| 107 |
+
# Convert guidance_scale to float
|
| 108 |
+
try:
|
| 109 |
+
guidance_scale_float = float(guidance_scale) if guidance_scale else 0.0
|
| 110 |
+
except (ValueError, TypeError):
|
| 111 |
+
guidance_scale_float = 0.0
|
| 112 |
+
|
| 113 |
+
# Convert steps to int
|
| 114 |
+
try:
|
| 115 |
+
steps_int = int(steps) if steps else 9
|
| 116 |
+
except (ValueError, TypeError):
|
| 117 |
+
steps_int = 9
|
| 118 |
+
|
| 119 |
# Set scheduler
|
| 120 |
if scheduler == "EulerDiscrete":
|
| 121 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
|
|
|
| 134 |
result = pipe(
|
| 135 |
prompt=prompt,
|
| 136 |
negative_prompt=negative_prompt if negative_prompt else None,
|
| 137 |
+
num_inference_steps=steps_int,
|
| 138 |
+
guidance_scale=guidance_scale_float,
|
| 139 |
width=width,
|
| 140 |
height=height,
|
| 141 |
generator=generator,
|