Emperor555 Claude commited on
Commit
ef89b24
ยท
1 Parent(s): c39aa67

Add funny listener dropdown

Browse files

Replace textbox with dropdown of fun listeners:
- Just me (default, no special context)
- My confused grandmother
- A skeptical robot
- An alien visiting Earth
- A zombie (short attention span)
- A very smart fox
- A stressed CEO
- A distracted gamer

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +22 -8
app.py CHANGED
@@ -161,11 +161,21 @@ def create_app():
161
  )
162
 
163
  with gr.Row():
164
- audience_input = gr.Textbox(
165
- label="๐Ÿ‘ค Who are you? (optional)",
166
- placeholder="e.g., a college student, a CEO, my grandmother, a 10-year-old...",
167
- lines=1,
168
- max_lines=1,
 
 
 
 
 
 
 
 
 
 
169
  )
170
 
171
  explain_btn = gr.Button(
@@ -234,21 +244,25 @@ def create_app():
234
  )
235
 
236
  # Event handler
237
- def process_and_explain(topic, persona_with_emoji, gen_audio, audience):
238
  # Extract persona name (remove emoji prefix)
239
  persona_name = persona_with_emoji.split(" ", 1)[1] if " " in persona_with_emoji else persona_with_emoji
 
 
 
 
240
  return explain_topic(topic, persona_name, audience, gen_audio)
241
 
242
  explain_btn.click(
243
  fn=process_and_explain,
244
- inputs=[topic_input, persona_dropdown, audio_checkbox, audience_input],
245
  outputs=[explanation_output, audio_output, sources_output, steps_output, mcp_output],
246
  )
247
 
248
  # Also trigger on Enter key in topic input
249
  topic_input.submit(
250
  fn=process_and_explain,
251
- inputs=[topic_input, persona_dropdown, audio_checkbox, audience_input],
252
  outputs=[explanation_output, audio_output, sources_output, steps_output, mcp_output],
253
  )
254
 
 
161
  )
162
 
163
  with gr.Row():
164
+ # Funny listener options (don't overlap with personas)
165
+ listener_choices = [
166
+ "๐Ÿ‘ค Just me",
167
+ "๐Ÿ‘ต My confused grandmother",
168
+ "๐Ÿค– A skeptical robot",
169
+ "๐Ÿ‘ฝ An alien visiting Earth",
170
+ "๐ŸงŸ A zombie (short attention span)",
171
+ "๐ŸฆŠ A very smart fox",
172
+ "๐Ÿ‘” A stressed CEO",
173
+ "๐ŸŽฎ A distracted gamer",
174
+ ]
175
+ audience_dropdown = gr.Dropdown(
176
+ choices=listener_choices,
177
+ value=listener_choices[0],
178
+ label="๐Ÿ‘ค Who's listening?",
179
  )
180
 
181
  explain_btn = gr.Button(
 
244
  )
245
 
246
  # Event handler
247
+ def process_and_explain(topic, persona_with_emoji, gen_audio, audience_with_emoji):
248
  # Extract persona name (remove emoji prefix)
249
  persona_name = persona_with_emoji.split(" ", 1)[1] if " " in persona_with_emoji else persona_with_emoji
250
+ # Extract audience (remove emoji prefix), skip if "Just me"
251
+ audience = ""
252
+ if audience_with_emoji and "Just me" not in audience_with_emoji:
253
+ audience = audience_with_emoji.split(" ", 1)[1] if " " in audience_with_emoji else audience_with_emoji
254
  return explain_topic(topic, persona_name, audience, gen_audio)
255
 
256
  explain_btn.click(
257
  fn=process_and_explain,
258
+ inputs=[topic_input, persona_dropdown, audio_checkbox, audience_dropdown],
259
  outputs=[explanation_output, audio_output, sources_output, steps_output, mcp_output],
260
  )
261
 
262
  # Also trigger on Enter key in topic input
263
  topic_input.submit(
264
  fn=process_and_explain,
265
+ inputs=[topic_input, persona_dropdown, audio_checkbox, audience_dropdown],
266
  outputs=[explanation_output, audio_output, sources_output, steps_output, mcp_output],
267
  )
268