Spaces:
Runtime error
Runtime error
Commit
·
e1a5eb1
1
Parent(s):
8245707
next
Browse files- prompt_generator.py +14 -4
prompt_generator.py
CHANGED
|
@@ -128,10 +128,19 @@ class PromptGenerator:
|
|
| 128 |
def process_next_data(self, prompt, separator, category, field, value, attributes=False):
|
| 129 |
if category in self.next_data and field in self.next_data[category]:
|
| 130 |
field_data = self.next_data[category][field]
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
if value == "None":
|
| 137 |
return prompt
|
|
@@ -174,6 +183,7 @@ class PromptGenerator:
|
|
| 174 |
place, lighting, clothing, composition, pose, background, input_image, **next_params):
|
| 175 |
kwargs = locals()
|
| 176 |
del kwargs['self']
|
|
|
|
| 177 |
|
| 178 |
seed = kwargs.get("seed", 0)
|
| 179 |
if seed is not None:
|
|
|
|
| 128 |
def process_next_data(self, prompt, separator, category, field, value, attributes=False):
|
| 129 |
if category in self.next_data and field in self.next_data[category]:
|
| 130 |
field_data = self.next_data[category][field]
|
| 131 |
+
|
| 132 |
+
if isinstance(field_data, list):
|
| 133 |
+
items = field_data
|
| 134 |
+
preprompt = ""
|
| 135 |
+
field_separator = ", "
|
| 136 |
+
endprompt = ""
|
| 137 |
+
elif isinstance(field_data, dict):
|
| 138 |
+
items = field_data.get("items", [])
|
| 139 |
+
preprompt = str(field_data.get("preprompt", "")).strip()
|
| 140 |
+
field_separator = f" {str(field_data.get('separator', ', ')).strip()} "
|
| 141 |
+
endprompt = str(field_data.get("endprompt", "")).strip()
|
| 142 |
+
else:
|
| 143 |
+
return prompt
|
| 144 |
|
| 145 |
if value == "None":
|
| 146 |
return prompt
|
|
|
|
| 183 |
place, lighting, clothing, composition, pose, background, input_image, **next_params):
|
| 184 |
kwargs = locals()
|
| 185 |
del kwargs['self']
|
| 186 |
+
del kwargs['next_params']
|
| 187 |
|
| 188 |
seed = kwargs.get("seed", 0)
|
| 189 |
if seed is not None:
|