Spaces:
Runtime error
Runtime error
Eunchan Lee
commited on
Commit
·
db3725f
1
Parent(s):
72c6f28
app
Browse files
app.py
CHANGED
@@ -12,22 +12,15 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
12 |
import torch
|
13 |
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
st.write(x, 'squared is', x * x)
|
21 |
-
'''
|
22 |
|
23 |
|
24 |
def pegasus_abs_summarize(src_text):
|
25 |
|
26 |
-
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
27 |
-
model_name_xsum = 'google/pegasus-xsum'
|
28 |
-
|
29 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name_xsum)
|
30 |
-
model = PegasusForConditionalGeneration.from_pretrained(model_name_xsum).to(device)
|
31 |
|
32 |
batch = tokenizer(src_text, truncation=True, padding='longest', return_tensors="pt").to(device)
|
33 |
|
|
|
12 |
import torch
|
13 |
|
14 |
|
15 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
16 |
+
model_name_xsum = 'google/pegasus-xsum'
|
17 |
+
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_xsum)
|
19 |
+
model = PegasusForConditionalGeneration.from_pretrained(model_name_xsum).to(device)
|
|
|
|
|
20 |
|
21 |
|
22 |
def pegasus_abs_summarize(src_text):
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
batch = tokenizer(src_text, truncation=True, padding='longest', return_tensors="pt").to(device)
|
26 |
|