Spaces:
Runtime error
Runtime error
Update generate_propmts.py
Browse files- generate_propmts.py +3 -6
generate_propmts.py
CHANGED
|
@@ -51,22 +51,19 @@ def process_text(sentence, character_dict):
|
|
| 51 |
|
| 52 |
def generate_prompt(text, sentence_mapping, character_dict, selected_style):
|
| 53 |
"""
|
| 54 |
-
Generates a prompt
|
| 55 |
|
| 56 |
Parameters:
|
| 57 |
- style (str): The chosen illustration style.
|
| 58 |
- text (str): The input text for the illustration.
|
| 59 |
|
| 60 |
Returns:
|
| 61 |
-
tuple: A
|
| 62 |
"""
|
| 63 |
# Retrieve the enhanced sentence associated with the original text
|
| 64 |
enhanced_sentence = sentence_mapping.get(text, text)
|
| 65 |
image_descriptions = process_text(enhanced_sentence, character_dict)
|
| 66 |
# Define prompts and other parameters
|
| 67 |
prompt = f"Make an illustration in {selected_style} style from: {image_descriptions}"
|
| 68 |
-
|
| 69 |
-
"fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, " \
|
| 70 |
-
"watermark, username, blurry "
|
| 71 |
-
return prompt, negative_prompt
|
| 72 |
|
|
|
|
| 51 |
|
| 52 |
def generate_prompt(text, sentence_mapping, character_dict, selected_style):
|
| 53 |
"""
|
| 54 |
+
Generates a prompt for image generation based on the selected style and input text.
|
| 55 |
|
| 56 |
Parameters:
|
| 57 |
- style (str): The chosen illustration style.
|
| 58 |
- text (str): The input text for the illustration.
|
| 59 |
|
| 60 |
Returns:
|
| 61 |
+
tuple: A prompt string.
|
| 62 |
"""
|
| 63 |
# Retrieve the enhanced sentence associated with the original text
|
| 64 |
enhanced_sentence = sentence_mapping.get(text, text)
|
| 65 |
image_descriptions = process_text(enhanced_sentence, character_dict)
|
| 66 |
# Define prompts and other parameters
|
| 67 |
prompt = f"Make an illustration in {selected_style} style from: {image_descriptions}"
|
| 68 |
+
return prompt
|
|
|
|
|
|
|
|
|
|
| 69 |
|