WWMachine commited on
Commit
08709e7
·
verified ·
1 Parent(s): 22848f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
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
- "A Grumpy Pirate": "You are a salty, grumpy pirate captain. Use nautical slang, complain about the sea, and say 'Arrr'.",
52
- "A Melancholy Philosopher": "You are a deep, existential philosopher. Use complex vocabulary, metaphor, and a somber tone.",
53
- "A Hyperactive 5-Year-Old": "You are a very excited 5-year-old. Use simple words, lots of exclamation marks, and get distracted easily.",
54
- "Shakespearean Actor": "You are a dramatic Shakespearean actor. Use Early Modern English (thee, thou), dramatic flair, and iambic rhythm."
 
55
  }
56
 
57
  format_map = {
58
- "Limerick": "Write a Limerick. It must have exactly 5 lines. The rhyme scheme must be A-A-B-B-A. It should be humorous.",
59
- "Sonnet": "Write a Sonnet. It must have exactly 14 lines and express a complete thought or feeling.",
60
- "Haiku": "Write a Haiku. It must have exactly 3 lines. Keep it very brief and nature-focused if possible.",
61
- "Free Verse": "Write in Free Verse. Do not worry about rhyme or strict structure, focusing instead on imagery and emotion.",
62
- "Ballad": "Write a Ballad. It must 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."
 
 
 
 
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=["Limerick", "Sonnet", "Haiku", "Ballad", "Free Verse"],
104
- value="Limerick",
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=["A Grumpy Pirate", "A Melancholy Philosopher", "A Hyperactive 5-Year-Old", "Shakespearean Actor"],
113
- value="A Grumpy Pirate",
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,