Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,11 +48,11 @@ def generate_poem(format_type, persona, topic, progress=gr.Progress()):
|
|
| 48 |
time.sleep(0.3)
|
| 49 |
|
| 50 |
persona_map = {
|
| 51 |
-
"Grumpy Pirate": "You are a grumpy and annoyed pirate captain. Use salty nautical slang, complain about the sea
|
| 52 |
-
"Philosopher": "You are
|
| 53 |
-
"
|
| 54 |
"Shakespearean Actor": "You are a Shakespearean actor. Use Early Modern English (thee, thou) and dramatic flair.",
|
| 55 |
-
"Sarcastic Teenager": "You are a sarcastic teenager. Use dry humor
|
| 56 |
}
|
| 57 |
|
| 58 |
format_map = {
|
|
@@ -71,9 +71,10 @@ def generate_poem(format_type, persona, topic, progress=gr.Progress()):
|
|
| 71 |
selected_constraint = format_map.get(format_type, "Write a poem.")
|
| 72 |
|
| 73 |
full_prompt = (
|
|
|
|
| 74 |
f"{selected_voice}\n"
|
| 75 |
f"{selected_constraint}\n"
|
| 76 |
-
f"Your response should only contain the
|
| 77 |
f"The {format_type} should focus on this topic: '{topic}'.\n\n"
|
| 78 |
|
| 79 |
)
|
|
@@ -114,7 +115,7 @@ with gr.Blocks(title="The Poetry Workshop", theme=gr.themes.Soft()) as demo:
|
|
| 114 |
)
|
| 115 |
gr.Markdown("### in the style of ")
|
| 116 |
persona_dropdown = gr.Dropdown(
|
| 117 |
-
choices=["Grumpy Pirate", "Philosopher", "Shakespearean Actor", "
|
| 118 |
value="Grumpy Pirate",
|
| 119 |
label="Persona",
|
| 120 |
show_label=False,
|
|
|
|
| 48 |
time.sleep(0.3)
|
| 49 |
|
| 50 |
persona_map = {
|
| 51 |
+
"Grumpy Pirate": "You are a grumpy and annoyed pirate captain. Use salty nautical slang, complain about the sea and use 'Arrr' and 'matey'.",
|
| 52 |
+
"Philosopher": "You are a philosopher. Use metaphors and reflective musings about the human condition.",
|
| 53 |
+
"Ancient Wizard": "You are an ancient wizard. Speak in mystical tones. Use prophecy-like statements and references to magic.",
|
| 54 |
"Shakespearean Actor": "You are a Shakespearean actor. Use Early Modern English (thee, thou) and dramatic flair.",
|
| 55 |
+
"Sarcastic Teenager": "You are a sarcastic teenager. Use dry humor."
|
| 56 |
}
|
| 57 |
|
| 58 |
format_map = {
|
|
|
|
| 71 |
selected_constraint = format_map.get(format_type, "Write a poem.")
|
| 72 |
|
| 73 |
full_prompt = (
|
| 74 |
+
f"Write a poem with rhymes.\n"
|
| 75 |
f"{selected_voice}\n"
|
| 76 |
f"{selected_constraint}\n"
|
| 77 |
+
f"Your response should only contain the poem.\n"
|
| 78 |
f"The {format_type} should focus on this topic: '{topic}'.\n\n"
|
| 79 |
|
| 80 |
)
|
|
|
|
| 115 |
)
|
| 116 |
gr.Markdown("### in the style of ")
|
| 117 |
persona_dropdown = gr.Dropdown(
|
| 118 |
+
choices=["Grumpy Pirate", "Philosopher", "Shakespearean Actor", "Ancient Wizard", "Sarcastic Teenager"],
|
| 119 |
value="Grumpy Pirate",
|
| 120 |
label="Persona",
|
| 121 |
show_label=False,
|