Goated121 commited on
Commit
ecd0b27
·
verified ·
1 Parent(s): 1a86260

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -111,13 +111,23 @@ Question:
111
  Answer in short and clear sentences.
112
  """
113
 
114
- response = generator(prompt, max_new_tokens=150, do_sample=True, temperature=0.6)
 
 
 
 
 
 
 
115
  text = response[0]["generated_text"]
116
 
117
  # Remove prompt repetition
118
  if prompt.strip() in text:
119
  text = text.split(prompt.strip())[-1].strip()
120
 
 
 
 
121
  return text
122
 
123
  # -----------------------------
 
111
  Answer in short and clear sentences.
112
  """
113
 
114
+ response = generator(
115
+ prompt,
116
+ max_new_tokens=100,
117
+ do_sample=True,
118
+ temperature=0.6,
119
+ pad_token_id=tokenizer.eos_token_id
120
+ )
121
+
122
  text = response[0]["generated_text"]
123
 
124
  # Remove prompt repetition
125
  if prompt.strip() in text:
126
  text = text.split(prompt.strip())[-1].strip()
127
 
128
+ # Keep only first paragraph or sentence to avoid repetition
129
+ text = text.split("\n")[0].strip()
130
+
131
  return text
132
 
133
  # -----------------------------