Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,6 @@ import gradio as gr
|
|
| 3 |
import torch
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
# Set up the model
|
| 9 |
model_id = "meta-llama/Llama-3.2-3B"
|
| 10 |
pipe = pipeline(
|
|
@@ -14,8 +12,6 @@ pipe = pipeline(
|
|
| 14 |
device_map="cuda"
|
| 15 |
)
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
@spaces.GPU
|
| 20 |
def generate_text(prompt):
|
| 21 |
response = pipe(prompt, max_length=100, num_return_sequences=1)
|
|
@@ -38,14 +34,23 @@ footer {text-align: center; padding: 10px;}
|
|
| 38 |
with gr.Blocks(css=css) as journal_app:
|
| 39 |
|
| 40 |
# Header and icons
|
| 41 |
-
gr.Image(value="https://cdn-icons-png.flaticon.com/512/2919/2919600.png", elem_id="icon", show_label=False)
|
| 42 |
gr.Markdown("# π Productivity Journal")
|
| 43 |
gr.Markdown("Welcome to your personalized productivity journal. Enter your thoughts and let AI inspire you to stay on track!")
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
with gr.Row():
|
| 46 |
with gr.Column():
|
| 47 |
# Input text box
|
| 48 |
-
prompt = gr.Textbox(label="
|
| 49 |
|
| 50 |
with gr.Column():
|
| 51 |
# Output for generated text
|
|
|
|
| 3 |
import torch
|
| 4 |
from transformers import pipeline
|
| 5 |
|
|
|
|
|
|
|
| 6 |
# Set up the model
|
| 7 |
model_id = "meta-llama/Llama-3.2-3B"
|
| 8 |
pipe = pipeline(
|
|
|
|
| 12 |
device_map="cuda"
|
| 13 |
)
|
| 14 |
|
|
|
|
|
|
|
| 15 |
@spaces.GPU
|
| 16 |
def generate_text(prompt):
|
| 17 |
response = pipe(prompt, max_length=100, num_return_sequences=1)
|
|
|
|
| 34 |
with gr.Blocks(css=css) as journal_app:
|
| 35 |
|
| 36 |
# Header and icons
|
|
|
|
| 37 |
gr.Markdown("# π Productivity Journal")
|
| 38 |
gr.Markdown("Welcome to your personalized productivity journal. Enter your thoughts and let AI inspire you to stay on track!")
|
| 39 |
|
| 40 |
+
# Provide guided prompts to help the user write their entry
|
| 41 |
+
gr.Markdown("### **Here are some ideas to get started:**")
|
| 42 |
+
gr.Markdown("""
|
| 43 |
+
- π *What's one thing you accomplished today that you're proud of?*
|
| 44 |
+
- π§ *What was your biggest challenge today? How did you overcome it?*
|
| 45 |
+
- π― *What's a goal you want to focus on tomorrow?*
|
| 46 |
+
- π *What are you feeling grateful for right now?*
|
| 47 |
+
- π *What's one new thing you learned today, and how can you apply it?*
|
| 48 |
+
""")
|
| 49 |
+
|
| 50 |
with gr.Row():
|
| 51 |
with gr.Column():
|
| 52 |
# Input text box
|
| 53 |
+
prompt = gr.Textbox(label="Write your thoughts here:", placeholder="Start with a reflection or goal...", elem_id="prompt_box", lines=5)
|
| 54 |
|
| 55 |
with gr.Column():
|
| 56 |
# Output for generated text
|