Spaces:
Sleeping
Sleeping
File size: 445 Bytes
cee4b22 |
1 2 3 4 5 6 7 8 9 10 11 12 |
import re
def preprocess_input(mood, theme, style):
"""Preprocess the user's mood, theme, and style input."""
input_text = f"Write a poem with a {mood} mood, about the theme of {theme}, in the style of {style}."
input_text = preprocess_text(input_text)
return input_text
def preprocess_text(text):
"""Preprocess the input text (e.g., clean, tokenize)."""
text = re.sub(r'\s+', ' ', text.strip().lower())
return text |