mjpsm commited on
Commit
8121d92
·
verified ·
1 Parent(s): 04f8f11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,7 +11,7 @@ model = AutoModelForCausalLM.from_pretrained(model_name)
11
  # Generation function
12
  def generate_affirmation(description):
13
  # Structured prompt to guide model output
14
- prompt = f"[SUBJECT] learning [/SUBJECT] [STREAK] current performance context [/STREAK] [CONTEXT] {description} [/CONTEXT] [AFFIRMATION]"
15
 
16
  inputs = tokenizer(prompt, return_tensors="pt")
17
  input_ids = inputs["input_ids"]
@@ -19,7 +19,7 @@ def generate_affirmation(description):
19
  with torch.no_grad():
20
  outputs = model.generate(
21
  input_ids,
22
- max_new_tokens=60,
23
  temperature=0.7,
24
  top_k=50,
25
  top_p=0.95,
 
11
  # Generation function
12
  def generate_affirmation(description):
13
  # Structured prompt to guide model output
14
+ prompt = f"[SUBJECT] learning [/SUBJECT] [STREAK] current performance context [/STREAK] [CONTEXT] {description} [/CONTEXT] [AFFIRMATION] Give two positive affirmations. [/AFFIRMATION]"
15
 
16
  inputs = tokenizer(prompt, return_tensors="pt")
17
  input_ids = inputs["input_ids"]
 
19
  with torch.no_grad():
20
  outputs = model.generate(
21
  input_ids,
22
+ max_new_tokens=100,
23
  temperature=0.7,
24
  top_k=50,
25
  top_p=0.95,