haramkoo commited on
Commit
99c08ee
·
1 Parent(s): 5d31a5d

webapp update 03-07-2022 6:59 pm

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -8,15 +8,12 @@ tok = BartTokenizer.from_pretrained("hyechanjun/interview-question-remake")
8
 
9
  def genQuestion(context):
10
  inputs = tok(context, return_tensors="pt")
11
- output = model.generate(inputs["input_ids"], num_beams=4, max_length=64, min_length=9)
12
  final_output = ''
13
- all_beams = []
14
 
15
  for i in range(4):
16
- all_beams.append([tok.decode(beam, skip_special_tokens=True, clean_up_tokenization_spaces=False) for beam in output][i])
17
 
18
- for i in len(all_beams)
19
- final_output += all_beams[i] + "\n"
20
  return final_output
21
 
22
  iface = gr.Interface(fn=genQuestion, inputs="text", outputs="text")
 
8
 
9
  def genQuestion(context):
10
  inputs = tok(context, return_tensors="pt")
11
+ output = model.generate(inputs["input_ids"], num_beams=4, max_length=64, min_length=9, num_return_sequences=4, diversity_penalty =1.0)
12
  final_output = ''
 
13
 
14
  for i in range(4):
15
+ final_output += [tok.decode(beam, skip_special_tokens=True, clean_up_tokenization_spaces=False) for beam in output][i] + "\n"
16
 
 
 
17
  return final_output
18
 
19
  iface = gr.Interface(fn=genQuestion, inputs="text", outputs="text")