yasserrmd commited on
Commit
e2046ce
·
verified ·
1 Parent(s): 10356bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -3,15 +3,25 @@ import gradio as gr
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(
9
- "text-generation",
10
- model=model_id,
11
- torch_dtype=torch.bfloat16,
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)
 
3
  import torch
4
  from transformers import pipeline
5
 
6
+ model_id = "meta-llama/Llama-3.2-3B-Instruct"
 
7
  pipe = pipeline(
8
+ "text-generation",
9
+ model=model_id,
10
+ torch_dtype=torch.bfloat16,
11
+ device_map="auto",
12
  )
13
 
14
+
15
+ messages = [
16
+ {"role": "system", "content": """
17
+ You are an insightful and empathetic journal assistant. Your goal is to help the user reflect on their daily experiences by offering thoughtful responses.
18
+ Encourage the user to think deeply about their day, acknowledge their feelings, suggest possible improvements, and reinforce positive achievements.
19
+ Your responses should feel warm, supportive, and introspective, promoting a balanced perspective and personal growth.
20
+ Use a conversational, reflective tone, and offer subtle suggestions or questions for further thought when appropriate.
21
+ """},
22
+ {"role": "user", "content": "Today, I learned a valuable lesson about time management and how it can improve productivity."}, # User's journal entry
23
+ ]
24
+
25
  @spaces.GPU
26
  def generate_text(prompt):
27
  response = pipe(prompt, max_length=100, num_return_sequences=1)