Tonic commited on
Commit
975dca5
1 Parent(s): 2647efe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -18,7 +18,7 @@ model.to(device)
18
  def generate_text(question):
19
  prompt = f'Q: {question}\nA:'
20
  input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
21
- tokens = model.generate(input_ids, max_length=22, pad_token_id=tokenizer.eos_token_id)
22
  response = tokenizer.decode(tokens[0], skip_special_tokens=False)
23
  return response.split('\nA: ')[-1]
24
 
 
18
  def generate_text(question):
19
  prompt = f'Q: {question}\nA:'
20
  input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
21
+ tokens = model.generate(input_ids, max_length=50, pad_token_id=tokenizer.eos_token_id)
22
  response = tokenizer.decode(tokens[0], skip_special_tokens=False)
23
  return response.split('\nA: ')[-1]
24