Spaces:
Sleeping
Sleeping
literary_style move
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ CHARACTER_DEFAULT = "The Old Lady Who Swallowed A Fly"
|
|
20 |
# )
|
21 |
PROMPT_TEMPLATE = PromptTemplate(
|
22 |
input_variables=["num_words", "literary_style", "emotions", "character", "original_words"],
|
23 |
-
template="{num_words}{
|
24 |
)
|
25 |
|
26 |
def set_openai_api_key(api_key, openai_api_key, temperature, llm_chain):
|
@@ -95,16 +95,16 @@ def transform_text(desc, openai_api_key, temperature, llm_chain, num_words,
|
|
95 |
# if translate_to != TRANSLATE_TO_DEFAULT:
|
96 |
# translate_to_str = "translated to " + translate_to + ", "
|
97 |
|
98 |
-
literary_style_str = "as a poem
|
99 |
if literary_style != LITERARY_STYLE_DEFAULT:
|
100 |
if literary_style == "Haiku":
|
101 |
-
literary_style_str = "as a haiku
|
102 |
elif literary_style == "Limerick":
|
103 |
-
literary_style_str = "as a limerick
|
104 |
# elif literary_style == "Joke":
|
105 |
# literary_style_str = "as a very funny joke with a setup and punchline, "
|
106 |
elif literary_style == "Knock-knock":
|
107 |
-
literary_style_str = "as a very funny knock-knock joke
|
108 |
|
109 |
character_str = "as if written by The Old Lady Who Swallowed A Fly, "
|
110 |
if character != CHARACTER_DEFAULT:
|
|
|
20 |
# )
|
21 |
PROMPT_TEMPLATE = PromptTemplate(
|
22 |
input_variables=["num_words", "literary_style", "emotions", "character", "original_words"],
|
23 |
+
template="{num_words}{emotions}{character} express the following {literary_style}: \n{original_words}\n",
|
24 |
)
|
25 |
|
26 |
def set_openai_api_key(api_key, openai_api_key, temperature, llm_chain):
|
|
|
95 |
# if translate_to != TRANSLATE_TO_DEFAULT:
|
96 |
# translate_to_str = "translated to " + translate_to + ", "
|
97 |
|
98 |
+
literary_style_str = "as a poem"
|
99 |
if literary_style != LITERARY_STYLE_DEFAULT:
|
100 |
if literary_style == "Haiku":
|
101 |
+
literary_style_str = "as a haiku"
|
102 |
elif literary_style == "Limerick":
|
103 |
+
literary_style_str = "as a limerick"
|
104 |
# elif literary_style == "Joke":
|
105 |
# literary_style_str = "as a very funny joke with a setup and punchline, "
|
106 |
elif literary_style == "Knock-knock":
|
107 |
+
literary_style_str = "as a very funny knock-knock joke"
|
108 |
|
109 |
character_str = "as if written by The Old Lady Who Swallowed A Fly, "
|
110 |
if character != CHARACTER_DEFAULT:
|