PeterPinetree commited on
Commit
6e91174
·
verified ·
1 Parent(s): 99edc13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -201,8 +201,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
201
  # Header section with improved instructions
202
  gr.Markdown("""
203
  # 🔮 AI Story Studio
204
- **Collaborate with AI to craft your own adventure, one scene at a time.**
205
- Pick a genre, start with a prompt or write your own, and guide the story with your choices.
206
 
207
  > **Tip:** The more detail you provide, the deeper the story becomes.
208
  """)
@@ -213,7 +213,7 @@ Pick a genre, start with a prompt or write your own, and guide the story with yo
213
  with gr.Column(scale=3):
214
  # Chat window + user input - USING LIST FORMAT
215
  chatbot = gr.Chatbot(
216
- height=500,
217
  bubble_full_width=True,
218
  show_copy_button=True,
219
  avatar_images=(None, wizard_avatar),
@@ -253,14 +253,13 @@ Pick a genre, start with a prompt or write your own, and guide the story with yo
253
  starter_btn1 = gr.Button("Starter 1")
254
  starter_btn2 = gr.Button("Starter 2")
255
  starter_btn3 = gr.Button("Starter 3")
256
- starter_btn4 = gr.Button("Starter 4")
257
  starter_buttons = [starter_btn1, starter_btn2, starter_btn3, starter_btn4]
258
 
259
  # Simplified update function
260
  def update_starter_buttons(selected_genre):
261
  examples = get_examples_for_genre(selected_genre)
262
  results = []
263
- for i in range(4):
264
  if i < len(examples):
265
  results.append(examples[i])
266
  else:
@@ -319,9 +318,11 @@ Pick a genre, start with a prompt or write your own, and guide the story with yo
319
  clear.click(lambda: [], None, chatbot, queue=False)
320
  clear.click(lambda: "", None, msg, queue=False)
321
 
322
- # "Download My Story" row
323
- with gr.Row():
324
- save_btn = gr.Button("Download My Story", variant="secondary")
 
 
325
  story_output = gr.File(
326
  label="Download your story",
327
  file_count="single",
@@ -329,13 +330,13 @@ Pick a genre, start with a prompt or write your own, and guide the story with yo
329
  interactive=False,
330
  visible=True
331
  )
332
-
333
- save_btn.click(
334
- fn=save_story,
335
- inputs=[chatbot],
336
- outputs=story_output,
337
- queue=False # Process immediately
338
- )
339
 
340
  # Initialize buttons with default fantasy genre examples
341
  initial_examples = get_examples_for_genre("fantasy")
 
201
  # Header section with improved instructions
202
  gr.Markdown("""
203
  # 🔮 AI Story Studio
204
+ **Collaborate with AI to craft your own adventure, one scene at a time.**
205
+ Pick a genre, start with a prompt or write your own, and guide the story with your choices.
206
 
207
  > **Tip:** The more detail you provide, the deeper the story becomes.
208
  """)
 
213
  with gr.Column(scale=3):
214
  # Chat window + user input - USING LIST FORMAT
215
  chatbot = gr.Chatbot(
216
+ height=400,
217
  bubble_full_width=True,
218
  show_copy_button=True,
219
  avatar_images=(None, wizard_avatar),
 
253
  starter_btn1 = gr.Button("Starter 1")
254
  starter_btn2 = gr.Button("Starter 2")
255
  starter_btn3 = gr.Button("Starter 3")
 
256
  starter_buttons = [starter_btn1, starter_btn2, starter_btn3, starter_btn4]
257
 
258
  # Simplified update function
259
  def update_starter_buttons(selected_genre):
260
  examples = get_examples_for_genre(selected_genre)
261
  results = []
262
+ for i in range(3):
263
  if i < len(examples):
264
  results.append(examples[i])
265
  else:
 
318
  clear.click(lambda: [], None, chatbot, queue=False)
319
  clear.click(lambda: "", None, msg, queue=False)
320
 
321
+ # "Download My Story" row
322
+ with gr.Row():
323
+ save_btn = gr.Button("Download My Story", variant="secondary")
324
+
325
+ with gr.Column(scale=1, min_width=150): # Adjust width to make it smaller
326
  story_output = gr.File(
327
  label="Download your story",
328
  file_count="single",
 
330
  interactive=False,
331
  visible=True
332
  )
333
+
334
+ save_btn.click(
335
+ fn=save_story,
336
+ inputs=[chatbot],
337
+ outputs=story_output,
338
+ queue=False # Process immediately
339
+ )
340
 
341
  # Initialize buttons with default fantasy genre examples
342
  initial_examples = get_examples_for_genre("fantasy")