Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,8 @@ tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_bas
|
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
|
12 |
|
13 |
def paraphrase(
|
14 |
-
Content_to_Rephrase
|
|
|
15 |
):
|
16 |
input_ids = tokenizer(
|
17 |
f'paraphrase: {Content_to_Rephrase}',
|
@@ -20,7 +21,7 @@ def paraphrase(
|
|
20 |
truncation=True,
|
21 |
).input_ids
|
22 |
|
23 |
-
outputs = model.generate(input_ids)
|
24 |
|
25 |
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
26 |
res1 = res [0]
|
|
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
|
12 |
|
13 |
def paraphrase(
|
14 |
+
Content_to_Rephrase,
|
15 |
+
num_return_sequences=3,
|
16 |
):
|
17 |
input_ids = tokenizer(
|
18 |
f'paraphrase: {Content_to_Rephrase}',
|
|
|
21 |
truncation=True,
|
22 |
).input_ids
|
23 |
|
24 |
+
outputs = model.generate(input_ids, num_return_sequences=num_return_sequences)
|
25 |
|
26 |
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
27 |
res1 = res [0]
|