asd
Browse files
app.py
CHANGED
|
@@ -13,9 +13,9 @@ cuda_available = torch.cuda.is_available()
|
|
| 13 |
device = torch.device("cuda" if cuda_available else "cpu")
|
| 14 |
print(f"Using device: {device}")
|
| 15 |
|
| 16 |
-
paraphraser_model_name = "
|
| 17 |
-
paraphraser_tokenizer = AutoTokenizer.from_pretrained(paraphraser_model_name
|
| 18 |
-
paraphraser_model = AutoModelForSeq2SeqLM.from_pretrained(paraphraser_model_name
|
| 19 |
|
| 20 |
classifier_model_name = "andreas122001/roberta-mixed-detector"
|
| 21 |
classifier_tokenizer = AutoTokenizer.from_pretrained(classifier_model_name)
|
|
@@ -58,7 +58,7 @@ def generate_paraphrases(text, setting, output_format):
|
|
| 58 |
json_output = {"original_text": text, "paraphrased_versions": [], "combined_versions": [], "human_like_versions": []}
|
| 59 |
|
| 60 |
for i, sentence in enumerate(sentences):
|
| 61 |
-
inputs = paraphraser_tokenizer(
|
| 62 |
|
| 63 |
outputs = paraphraser_model.generate(
|
| 64 |
**inputs,
|
|
|
|
| 13 |
device = torch.device("cuda" if cuda_available else "cpu")
|
| 14 |
print(f"Using device: {device}")
|
| 15 |
|
| 16 |
+
paraphraser_model_name = "facebook/bart-large-cnn"
|
| 17 |
+
paraphraser_tokenizer = AutoTokenizer.from_pretrained(paraphraser_model_name)
|
| 18 |
+
paraphraser_model = AutoModelForSeq2SeqLM.from_pretrained(paraphraser_model_name).to(device)
|
| 19 |
|
| 20 |
classifier_model_name = "andreas122001/roberta-mixed-detector"
|
| 21 |
classifier_tokenizer = AutoTokenizer.from_pretrained(classifier_model_name)
|
|
|
|
| 58 |
json_output = {"original_text": text, "paraphrased_versions": [], "combined_versions": [], "human_like_versions": []}
|
| 59 |
|
| 60 |
for i, sentence in enumerate(sentences):
|
| 61 |
+
inputs = paraphraser_tokenizer(sentence, return_tensors="pt", max_length=max_length, truncation=True).to(device)
|
| 62 |
|
| 63 |
outputs = paraphraser_model.generate(
|
| 64 |
**inputs,
|