yasserrmd commited on
Commit
349b03b
1 Parent(s): 489147e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -40,7 +40,7 @@ example_entries = [
40
 
41
  # Function to return the selected prompt
42
  def fill_prompt(selected_prompt):
43
- return gr.update(value=selected_prompt)
44
 
45
  # Create the Gradio interface
46
  with gr.Blocks(css=css) as journal_app:
@@ -51,17 +51,14 @@ with gr.Blocks(css=css) as journal_app:
51
 
52
  # Example journal entries section
53
  gr.Markdown("### **Select an example to start writing:**")
54
-
55
- # Align buttons in grid format for better layout
56
- with gr.Row():
57
- with gr.Column():
58
- # Aligning buttons using columns and rows
59
- for i, entry in enumerate(example_entries):
60
- gr.Button(f"Example {i+1}").click(fn=lambda e=entry: fill_prompt(e), inputs=None, outputs="prompt_textbox")
61
 
62
  # Input text box for writing thoughts
 
 
 
63
  with gr.Row():
64
- prompt_textbox = gr.Textbox(label="Write your thoughts here:", placeholder="Start writing or select an example...", elem_id="prompt_box", lines=5)
 
65
 
66
  with gr.Row():
67
  # Output for generated text
 
40
 
41
  # Function to return the selected prompt
42
  def fill_prompt(selected_prompt):
43
+ return selected_prompt
44
 
45
  # Create the Gradio interface
46
  with gr.Blocks(css=css) as journal_app:
 
51
 
52
  # Example journal entries section
53
  gr.Markdown("### **Select an example to start writing:**")
 
 
 
 
 
 
 
54
 
55
  # Input text box for writing thoughts
56
+ prompt_textbox = gr.Textbox(label="Write your thoughts here:", placeholder="Start writing or select an example...", elem_id="prompt_box", lines=5)
57
+
58
+ # Align buttons using rows and columns for better layout
59
  with gr.Row():
60
+ for i, entry in enumerate(example_entries):
61
+ gr.Button(f"Example {i+1}").click(fn=lambda e=entry: fill_prompt(e), outputs=prompt_textbox)
62
 
63
  with gr.Row():
64
  # Output for generated text