LamaAl commited on
Commit
022b262
1 Parent(s): a649caa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -16,16 +16,12 @@ tokenizer = AutoTokenizer.from_pretrained("tareknaous/bert2bert-empathetic-respo
16
  model = EncoderDecoderModel.from_pretrained("tareknaous/bert2bert-empathetic-response-msa")
17
  model.eval()
18
 
19
- def generate_response(text, minimum_length, k, p, temperature):
20
  text_clean = arabert_prep.preprocess(text)
21
  inputs = tokenizer.encode_plus(text_clean,return_tensors='pt')
22
  outputs = model.generate(input_ids = inputs.input_ids,
23
  attention_mask = inputs.attention_mask,
24
- do_sample = True,
25
- min_length=minimum_length,
26
- top_k = k,
27
- top_p = p,
28
- temperature = temperature)
29
  preds = tokenizer.batch_decode(outputs)
30
  response = str(preds)
31
  response = response.replace("\'", '')
@@ -39,10 +35,6 @@ description = 'This demo is for a BERT2BERT model trained for single-turn open-d
39
  gr.Interface(fn=generate_response,
40
  inputs=[
41
  gr.inputs.Textbox(),
42
- gr.inputs.Slider(5, 20, step=1, label='Minimum Output Length'),
43
- gr.inputs.Slider(0, 1000, step=10, label='Top-K'),
44
- gr.inputs.Slider(0, 1, step=0.1, label='Top-P'),
45
- gr.inputs.Slider(0, 3, step=0.1, label='Temperature'),
46
  ],
47
  outputs="text",
48
  title=title,
 
16
  model = EncoderDecoderModel.from_pretrained("tareknaous/bert2bert-empathetic-response-msa")
17
  model.eval()
18
 
19
+ def generate_response(text):
20
  text_clean = arabert_prep.preprocess(text)
21
  inputs = tokenizer.encode_plus(text_clean,return_tensors='pt')
22
  outputs = model.generate(input_ids = inputs.input_ids,
23
  attention_mask = inputs.attention_mask,
24
+ do_sample = True)
 
 
 
 
25
  preds = tokenizer.batch_decode(outputs)
26
  response = str(preds)
27
  response = response.replace("\'", '')
 
35
  gr.Interface(fn=generate_response,
36
  inputs=[
37
  gr.inputs.Textbox(),
 
 
 
 
38
  ],
39
  outputs="text",
40
  title=title,