Update app.py
Browse files
app.py
CHANGED
|
@@ -20,13 +20,14 @@ def generate_text(prompt):
|
|
| 20 |
# Custom CSS for the app
|
| 21 |
css = """
|
| 22 |
body {background-color: #f0f8ff; font-family: 'Arial', sans-serif;}
|
| 23 |
-
.gradio-container {max-width:
|
| 24 |
-
textarea {border-radius: 10px; padding:
|
| 25 |
-
button {background-color: #4caf50; color:
|
| 26 |
button:hover {background-color: #45a049;}
|
| 27 |
-
h1 {color: #333; font-size:
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
"""
|
| 31 |
|
| 32 |
# Define example entries
|
|
@@ -49,19 +50,22 @@ with gr.Blocks(css=css) as journal_app:
|
|
| 49 |
gr.Markdown("# 📝 Productivity Journal")
|
| 50 |
gr.Markdown("Welcome to your personalized productivity journal. Click an example below or write your thoughts!")
|
| 51 |
|
| 52 |
-
#
|
| 53 |
-
gr.Markdown("### **
|
| 54 |
|
|
|
|
| 55 |
with gr.Row():
|
| 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 |
-
for i, entry in enumerate(example_entries):
|
| 59 |
-
gr.Button(f"Example {i+1}").click(fn=lambda e=entry: fill_prompt(e), inputs=None, outputs=prompt_textbox)
|
| 60 |
|
| 61 |
-
with gr.Row():
|
| 62 |
with gr.Column():
|
| 63 |
-
#
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# Generate button
|
| 67 |
generate_button = gr.Button("Generate Entry ✍️")
|
|
|
|
| 20 |
# Custom CSS for the app
|
| 21 |
css = """
|
| 22 |
body {background-color: #f0f8ff; font-family: 'Arial', sans-serif;}
|
| 23 |
+
.gradio-container {max-width: 900px; margin: 0 auto; border-radius: 15px; padding: 30px; background-color: white; box-shadow: 0 4px 8px rgba(0,0,0,0.1);}
|
| 24 |
+
textarea {border-radius: 10px; padding: 15px; font-size: 16px; border: 2px solid #ddd; width: 100%;}
|
| 25 |
+
button {background-color: #4caf50; color: white; border-radius: 10px; padding: 10px 15px; font-size: 16px; border: none; cursor: pointer; margin-top: 10px; margin-right: 5px;}
|
| 26 |
button:hover {background-color: #45a049;}
|
| 27 |
+
h1 {color: #333; font-size: 36px; text-align: center; margin-bottom: 20px;}
|
| 28 |
+
h2 {color: #555; font-size: 24px; margin-bottom: 10px;}
|
| 29 |
+
footer {text-align: center; padding: 20px; font-size: 14px;}
|
| 30 |
+
.grid {display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; justify-items: stretch;}
|
| 31 |
"""
|
| 32 |
|
| 33 |
# Define example entries
|
|
|
|
| 50 |
gr.Markdown("# 📝 Productivity Journal")
|
| 51 |
gr.Markdown("Welcome to your personalized productivity journal. Click an example below or write your thoughts!")
|
| 52 |
|
| 53 |
+
# Example journal entries section
|
| 54 |
+
gr.Markdown("### **Select an example to start writing:**")
|
| 55 |
|
| 56 |
+
# Align buttons in grid format for better layout
|
| 57 |
with gr.Row():
|
| 58 |
prompt_textbox = gr.Textbox(label="Write your thoughts here:", placeholder="Start writing or select an example...", elem_id="prompt_box", lines=5)
|
|
|
|
|
|
|
|
|
|
| 59 |
|
|
|
|
| 60 |
with gr.Column():
|
| 61 |
+
# Arrange example buttons in grid format
|
| 62 |
+
with gr.Box(elem_classes="grid"):
|
| 63 |
+
for i, entry in enumerate(example_entries):
|
| 64 |
+
gr.Button(f"Example {i+1}").click(fn=lambda e=entry: fill_prompt(e), inputs=None, outputs=prompt_textbox)
|
| 65 |
+
|
| 66 |
+
with gr.Row():
|
| 67 |
+
# Output for generated text
|
| 68 |
+
output = gr.Textbox(label="Your AI Journal Entry ✨", lines=6)
|
| 69 |
|
| 70 |
# Generate button
|
| 71 |
generate_button = gr.Button("Generate Entry ✍️")
|