Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,18 +48,23 @@ def generate_poem(format_type, persona, topic, progress=gr.Progress()):
|
|
| 48 |
time.sleep(0.3)
|
| 49 |
|
| 50 |
persona_map = {
|
| 51 |
-
"
|
| 52 |
-
"
|
| 53 |
-
"
|
| 54 |
-
"Shakespearean Actor": "You are a
|
|
|
|
| 55 |
}
|
| 56 |
|
| 57 |
format_map = {
|
| 58 |
-
|
| 59 |
-
"
|
| 60 |
-
"
|
| 61 |
-
"
|
| 62 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
}
|
| 64 |
|
| 65 |
selected_voice = persona_map.get(persona, "You are a helpful assistant.")
|
|
@@ -100,8 +105,8 @@ with gr.Blocks(title="The Poetry Workshop", theme=gr.themes.Soft()) as demo:
|
|
| 100 |
with gr.Row(equal_height=True):
|
| 101 |
gr.Markdown("### I want to write a ")
|
| 102 |
format_dropdown = gr.Dropdown(
|
| 103 |
-
choices=["
|
| 104 |
-
value="
|
| 105 |
label="Poem Type",
|
| 106 |
show_label=False,
|
| 107 |
container=False,
|
|
@@ -109,8 +114,8 @@ with gr.Blocks(title="The Poetry Workshop", theme=gr.themes.Soft()) as demo:
|
|
| 109 |
)
|
| 110 |
gr.Markdown("### in the style of ")
|
| 111 |
persona_dropdown = gr.Dropdown(
|
| 112 |
-
choices=["
|
| 113 |
-
value="
|
| 114 |
label="Persona",
|
| 115 |
show_label=False,
|
| 116 |
container=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 an existentialist philosopher. Use metaphors, paradoxes, and reflective musings about meaning and the human condition.",
|
| 53 |
+
"Crazy Wizard": "You are an ancient crazy wizard. Speak in mystical, archaic tones. Offer cryptic advice, 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 and mildly dramatic exaggeration."
|
| 56 |
}
|
| 57 |
|
| 58 |
format_map = {
|
| 59 |
+
|
| 60 |
+
"Free Verse": "Write in Free Verse about the topic. Focus on vivid imagery and emotion.",
|
| 61 |
+
"Ballad": "Write a Ballad about the topic. It should tell a narrative story with a clear beginning, middle, and end. Use four-line stanzas (quatrains) and a simple rhyme scheme like A-B-C-B. Keep the language simple and musical.",
|
| 62 |
+
"Ode": "Write an Ode about the topic. Use elevated, expressive language to praise or celebrate the subject. Focus on strong emotion, rich imagery, and admiration.",
|
| 63 |
+
"Elegy": "Write an Elegy about the topic. Use a somber, reflective tone to mourn a loss or contemplate death. Focus on sorrow, remembrance, and emotional depth.",
|
| 64 |
+
"Hymn": "Write a Hymn about the topic. Use a reverent, uplifting tone. Focus on praise, devotion, or spiritual reflection, with a rhythmic, chant-like flow.",
|
| 65 |
+
"Epic": "Write an Epic about the topic. Use grand, dramatic language to tell a heroic story."
|
| 66 |
+
|
| 67 |
+
|
| 68 |
}
|
| 69 |
|
| 70 |
selected_voice = persona_map.get(persona, "You are a helpful assistant.")
|
|
|
|
| 105 |
with gr.Row(equal_height=True):
|
| 106 |
gr.Markdown("### I want to write a ")
|
| 107 |
format_dropdown = gr.Dropdown(
|
| 108 |
+
choices=["Ballad","Ode","Elegy","Hymn","Epic", "Free Verse"],
|
| 109 |
+
value="Ballad",
|
| 110 |
label="Poem Type",
|
| 111 |
show_label=False,
|
| 112 |
container=False,
|
|
|
|
| 114 |
)
|
| 115 |
gr.Markdown("### in the style of ")
|
| 116 |
persona_dropdown = gr.Dropdown(
|
| 117 |
+
choices=["Grumpy Pirate", "Melancholy Philosopher", "Shakespearean Actor", "Crazy Wizard", "Sarcastic Teenager"],
|
| 118 |
+
value="Grumpy Pirate",
|
| 119 |
label="Persona",
|
| 120 |
show_label=False,
|
| 121 |
container=False,
|