Vaishakhh commited on
Commit
922bde8
1 Parent(s): 9ae941b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -50,8 +50,8 @@ model_pegasus = PegasusForConditionalGeneration.from_pretrained(model_name).to(t
50
  def get_max_str(lst):
51
  return max(lst, key=len)
52
  def get_response(input_text):
53
- batch = tokenizer.prepare_seq2seq_batch([input_text],truncation=True,padding='longest',max_length=60, return_tensors='pt').to(torch_device)
54
- translated = model_pegasus.generate(**batch,max_length=60,num_beams=15, num_return_sequences=15, temperature=1.5)
55
  #num_beam_groups=num_beams, diversity_penalty=0.5
56
  tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)
57
  try:
 
50
  def get_max_str(lst):
51
  return max(lst, key=len)
52
  def get_response(input_text):
53
+ batch = tokenizer.prepare_seq2seq_batch([input_text],truncation=True,padding='longest',max_length=30, return_tensors='pt').to(torch_device)
54
+ translated = model_pegasus.generate(**batch,max_length=30,num_beams=15, num_return_sequences=15, temperature=1.5)
55
  #num_beam_groups=num_beams, diversity_penalty=0.5
56
  tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)
57
  try: