PeterPinetree commited on
Commit
06d02d3
·
verified ·
1 Parent(s): c4ad27f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -169,6 +169,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
169
  bubble_full_width=False,
170
  show_copy_button=True,
171
  avatar_images=(None, "🧙"),
 
172
  )
173
  msg = gr.Textbox(
174
  placeholder="Describe what you want to do next in the story...",
@@ -197,11 +198,21 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
197
  )
198
 
199
  # Update examples when genre changes
 
 
 
 
 
 
 
 
 
200
  genre.change(
201
- fn=update_examples,
202
  inputs=[genre],
203
- outputs=[examples_box]
204
  )
 
205
 
206
  # Set up event handlers for the chatbot
207
  msg.submit(respond, [msg, chatbot, genre], [chatbot])
 
169
  bubble_full_width=False,
170
  show_copy_button=True,
171
  avatar_images=(None, "🧙"),
172
+ type="messages" # ✅ Fix for future Gradio updates
173
  )
174
  msg = gr.Textbox(
175
  placeholder="Describe what you want to do next in the story...",
 
198
  )
199
 
200
  # Update examples when genre changes
201
+ def update_example_text(genre):
202
+ return "\n".join(get_examples_for_genre(genre))
203
+
204
+ examples_textbox = gr.Textbox(
205
+ value=update_example_text("fantasy"),
206
+ label="Example Story Starters",
207
+ interactive=False
208
+ )
209
+
210
  genre.change(
211
+ fn=update_example_text,
212
  inputs=[genre],
213
+ outputs=[examples_textbox]
214
  )
215
+
216
 
217
  # Set up event handlers for the chatbot
218
  msg.submit(respond, [msg, chatbot, genre], [chatbot])