Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,7 +122,7 @@ def generate(
|
|
| 122 |
inference_steps: int = 4,
|
| 123 |
randomize_seed: bool = False,
|
| 124 |
use_resolution_binning: bool = True,
|
| 125 |
-
**
|
| 126 |
):
|
| 127 |
seed = int(randomize_seed_fn(seed, randomize_seed))
|
| 128 |
generator = torch.Generator().manual_seed(seed)
|
|
@@ -131,7 +131,10 @@ def generate(
|
|
| 131 |
negative_prompt = None # type: ignore
|
| 132 |
|
| 133 |
# Process color selections and their ratios
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
# Apply style and modify prompt based on color selections
|
| 137 |
prompt, negative_prompt = apply_style(style, prompt, color_selections)
|
|
|
|
| 122 |
inference_steps: int = 4,
|
| 123 |
randomize_seed: bool = False,
|
| 124 |
use_resolution_binning: bool = True,
|
| 125 |
+
**kwargs # This will capture all other keyword arguments dynamically
|
| 126 |
):
|
| 127 |
seed = int(randomize_seed_fn(seed, randomize_seed))
|
| 128 |
generator = torch.Generator().manual_seed(seed)
|
|
|
|
| 131 |
negative_prompt = None # type: ignore
|
| 132 |
|
| 133 |
# Process color selections and their ratios
|
| 134 |
+
# Extract color selections and ratios from kwargs
|
| 135 |
+
color_selections = {color: {"selected": kwargs.get(f"{color.lower()}_selected", False),
|
| 136 |
+
"ratio": kwargs.get(f"{color.lower()}_ratio", 0)}
|
| 137 |
+
for color in color_attributes}
|
| 138 |
|
| 139 |
# Apply style and modify prompt based on color selections
|
| 140 |
prompt, negative_prompt = apply_style(style, prompt, color_selections)
|