Spaces:
Runtime error
Runtime error
gokaygokay
commited on
Commit
•
5bb1103
1
Parent(s):
e5117b9
next
Browse files- prompt_generator.py +9 -2
- ui_components.py +2 -3
prompt_generator.py
CHANGED
@@ -313,11 +313,18 @@ class PromptGenerator:
|
|
313 |
replaced = self.clean_consecutive_commas(replaced)
|
314 |
|
315 |
# Process next_params
|
|
|
316 |
for category, fields in next_params.items():
|
317 |
for field, value in fields.items():
|
318 |
-
|
|
|
|
|
319 |
|
320 |
-
|
|
|
|
|
|
|
|
|
321 |
|
322 |
def add_caption_to_prompt(self, prompt, caption):
|
323 |
if caption:
|
|
|
313 |
replaced = self.clean_consecutive_commas(replaced)
|
314 |
|
315 |
# Process next_params
|
316 |
+
next_prompts = []
|
317 |
for category, fields in next_params.items():
|
318 |
for field, value in fields.items():
|
319 |
+
next_prompt = self.process_next_data("", ", ", category, field, value)
|
320 |
+
if next_prompt:
|
321 |
+
next_prompts.append(next_prompt.strip())
|
322 |
|
323 |
+
# Combine main prompt with next prompts
|
324 |
+
combined_prompt = replaced + " " + " ".join(next_prompts)
|
325 |
+
combined_prompt = self.clean_consecutive_commas(combined_prompt)
|
326 |
+
|
327 |
+
return self.process_string(combined_prompt, seed)
|
328 |
|
329 |
def add_caption_to_prompt(self, prompt, caption):
|
330 |
if caption:
|
ui_components.py
CHANGED
@@ -136,11 +136,10 @@ def create_interface():
|
|
136 |
# Call generate_prompt with the correct arguments
|
137 |
result = prompt_generator.generate_prompt(dynamic_seed, *main_args, next_params=next_params)
|
138 |
|
|
|
139 |
main_prompt = result[0]
|
140 |
-
next_prompts = [v for category in next_params.values() for v in category.values() if v]
|
141 |
-
combined_prompt = main_prompt + " " + " ".join(next_prompts)
|
142 |
|
143 |
-
return [dynamic_seed
|
144 |
|
145 |
generate_button.click(
|
146 |
generate_prompt_with_dynamic_seed,
|
|
|
136 |
# Call generate_prompt with the correct arguments
|
137 |
result = prompt_generator.generate_prompt(dynamic_seed, *main_args, next_params=next_params)
|
138 |
|
139 |
+
# The main prompt is now the first element of the result
|
140 |
main_prompt = result[0]
|
|
|
|
|
141 |
|
142 |
+
return [dynamic_seed] + list(result)
|
143 |
|
144 |
generate_button.click(
|
145 |
generate_prompt_with_dynamic_seed,
|