Spaces:
Sleeping
Sleeping
Commit
·
f998692
1
Parent(s):
1832ead
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import os
|
|
| 6 |
import docx2txt
|
| 7 |
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
|
| 9 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("checkpoint-64840").
|
| 10 |
|
| 11 |
def summarize(text_file):
|
| 12 |
file_extension = os.path.splitext(text_file.name)[1]
|
|
@@ -20,7 +20,7 @@ def summarize(text_file):
|
|
| 20 |
else:
|
| 21 |
raise ValueError(f"Unsupported file type: {file_extension}")
|
| 22 |
|
| 23 |
-
input_ids = tokenizer(text, return_tensors="pt").input_ids.to("
|
| 24 |
global_attention_mask = torch.zeros_like(input_ids)
|
| 25 |
# set global_attention_mask on first token
|
| 26 |
global_attention_mask[:, 0] = 1
|
|
|
|
| 6 |
import docx2txt
|
| 7 |
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
|
| 9 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("checkpoint-64840").to("cpu")
|
| 10 |
|
| 11 |
def summarize(text_file):
|
| 12 |
file_extension = os.path.splitext(text_file.name)[1]
|
|
|
|
| 20 |
else:
|
| 21 |
raise ValueError(f"Unsupported file type: {file_extension}")
|
| 22 |
|
| 23 |
+
input_ids = tokenizer(text, return_tensors="pt").input_ids.to("cpu")
|
| 24 |
global_attention_mask = torch.zeros_like(input_ids)
|
| 25 |
# set global_attention_mask on first token
|
| 26 |
global_attention_mask[:, 0] = 1
|