Update app.py
Browse files
app.py
CHANGED
|
@@ -49,18 +49,21 @@ load_llm()
|
|
| 49 |
|
| 50 |
# --- Persona and Format Maps (Hardened Constraints) ---
|
| 51 |
persona_map = {
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
| 56 |
}
|
| 57 |
|
| 58 |
format_map = {
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
| 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=["
|
| 189 |
-
value="
|
| 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=["
|
| 198 |
-
value="
|
| 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,
|