Kezovic commited on
Commit
2dca569
·
verified ·
1 Parent(s): 0307e4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -13
app.py CHANGED
@@ -49,18 +49,21 @@ load_llm()
49
 
50
  # --- Persona and Format Maps (Hardened Constraints) ---
51
  persona_map = {
52
- "A Grumpy Pirate": "You are a salty, grumpy pirate captain. Use nautical slang, complain about the sea, and say 'Arrr'.",
53
- "A Melancholy Philosopher": "You are a deep, existential philosopher. Use complex vocabulary, metaphor, and a somber tone.",
54
- "A Hyperactive 5-Year-Old": "You are a very excited 5-year-old. Use simple words, lots of exclamation marks, and get distracted easily.",
55
- "Shakespearean Actor": "You are a dramatic Shakespearean actor. Use Early Modern English (thee, thou), dramatic flair, and iambic rhythm."
 
56
  }
57
 
58
  format_map = {
59
- "Limerick": "The poem MUST have exactly 5 lines (A-A-B-B-A rhyme scheme) and be HUMOROUS.",
60
- "Sonnet": "The poem MUST have exactly 14 lines and express a complete thought or feeling.",
61
- "Haiku": "The poem ABSOLUTELY MUST have exactly 3 lines. The syllable structure should be 5-7-5 (approximate). Focus on nature and brevity.",
62
- "Free Verse": "The poem should be written in Free Verse. It should have 6-10 lines and focus on imagery and emotion without strict rhyme or rhythm.",
63
- "Ballad": "The poem MUST tell a narrative story using four-line stanzas (quatrains) and a simple rhyme scheme like A-B-C-B. It should be 4-6 stanzas long."
 
 
64
  }
65
 
66
  # --- Refinement Instruction Map ---
@@ -185,8 +188,8 @@ with gr.Blocks(title="The Poetry Workshop", theme=gr.themes.Soft()) as demo:
185
  with gr.Row(equal_height=True):
186
  gr.Markdown("### I want to write a ")
187
  format_dropdown = gr.Dropdown(
188
- choices=["Limerick", "Sonnet", "Haiku", "Ballad", "Free Verse"],
189
- value="Limerick",
190
  label="Poem Type",
191
  show_label=False,
192
  container=False,
@@ -194,8 +197,8 @@ with gr.Blocks(title="The Poetry Workshop", theme=gr.themes.Soft()) as demo:
194
  )
195
  gr.Markdown("### in the style of ")
196
  persona_dropdown = gr.Dropdown(
197
- choices=["A Grumpy Pirate", "A Melancholy Philosopher", "A Hyperactive 5-Year-Old", "Shakespearean Actor"],
198
- value="A Grumpy Pirate",
199
  label="Persona",
200
  show_label=False,
201
  container=False,
 
49
 
50
  # --- Persona and Format Maps (Hardened Constraints) ---
51
  persona_map = {
52
+ "Grumpy Pirate": "You are a grumpy and annoyed pirate captain. Use salty nautical slang, complain about the sea and use 'Arrr' and 'matey'.",
53
+ "Philosopher": "You are a philosopher. Use metaphors and reflective musings about the human condition.",
54
+ "Ancient Wizard": "You are an ancient wizard. Speak in mystical tones. Use references to magic.",
55
+ "Shakespearean Actor": "You are a Shakespearean actor. Use Early Modern English (thee, thou) and dramatic flair.",
56
+ "Sarcastic Teenager": "You are a sarcastic teenager. Use dry humor."
57
  }
58
 
59
  format_map = {
60
+
61
+ "Free Verse": "Write in Free Verse about the topic. Focus on vivid imagery and emotion.",
62
+ "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.",
63
+ "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.",
64
+ "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.",
65
+ "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.",
66
+ "Epic": "Write an Epic about the topic. Use grand, dramatic language to tell a heroic story."
67
  }
68
 
69
  # --- Refinement Instruction Map ---
 
188
  with gr.Row(equal_height=True):
189
  gr.Markdown("### I want to write a ")
190
  format_dropdown = gr.Dropdown(
191
+ choices=["Free Verse", "Ballad", "Ode", "Elegy", "Hymn", "Epic"],
192
+ value="Free Verse",
193
  label="Poem Type",
194
  show_label=False,
195
  container=False,
 
197
  )
198
  gr.Markdown("### in the style of ")
199
  persona_dropdown = gr.Dropdown(
200
+ choices=["Grumpy Pirate", "Philosopher", "Ancient Wizard", "Shakespearean Actor", "Sarcastic Teenager"],
201
+ value="Grumpy Pirate",
202
  label="Persona",
203
  show_label=False,
204
  container=False,