milyiyo commited on
Commit
bf1499f
1 Parent(s): 25ced57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -107,27 +107,27 @@ def paraphrase(sentence: str, count: str):
107
  # print(res)
108
 
109
  #
110
- input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
111
- outputs = model.generate(input_ids=input_ids,
112
- attention_mask=attention_masks,
113
- max_length=512,
114
- do_sample=True,
115
- top_k=120,
116
- top_p=0.95,
117
- early_stopping=True,
118
- num_return_sequences=p_count)
119
- result_v4 = []
120
- for output in outputs:
121
- line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
122
- result_v4.append(line)
123
  #
124
 
125
  return {
126
  'result': {
127
- # 'generate_v1':generate_v1(encoding, count),
128
- # 'generate_v2':generate_v2(encoding, count),
129
- # 'generate_v3':generate_v3(encoding, count),
130
- 'generate_v4':result_v4
131
  }
132
  }
133
 
 
107
  # print(res)
108
 
109
  #
110
+ # input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
111
+ # outputs = model.generate(input_ids=input_ids,
112
+ # attention_mask=attention_masks,
113
+ # max_length=512,
114
+ # do_sample=True,
115
+ # top_k=120,
116
+ # top_p=0.95,
117
+ # early_stopping=True,
118
+ # num_return_sequences=p_count)
119
+ # result_v4 = []
120
+ # for output in outputs:
121
+ # line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
122
+ # result_v4.append(line)
123
  #
124
 
125
  return {
126
  'result': {
127
+ 'generate_v1':generate_v1(encoding, p_count),
128
+ 'generate_v2':generate_v2(encoding, p_count),
129
+ 'generate_v3':generate_v3(encoding, p_count),
130
+ 'generate_v4':generate_v4(encoding, p_count)
131
  }
132
  }
133