Spaces:
Runtime error
Runtime error
Commit
·
576fb99
1
Parent(s):
d472e80
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def summarize(word):
|
| 2 |
import os
|
| 3 |
data_path = "/tmp/"
|
|
@@ -25,7 +33,7 @@ def summarize(word):
|
|
| 25 |
final_summary = []
|
| 26 |
for x in range(0,len(text)-1256,1256):
|
| 27 |
text_to_summarize= text[x:x+1256]
|
| 28 |
-
final_summary.append(
|
| 29 |
|
| 30 |
final_list = list(itertools.chain.from_iterable(final_summary))
|
| 31 |
final_list = ''.join(final_list)
|
|
|
|
| 1 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 2 |
+
|
| 3 |
+
checkpoint = "Shivam29rathore/t5_10k_base"
|
| 4 |
+
|
| 5 |
+
#tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
| 6 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
def summarize(word):
|
| 10 |
import os
|
| 11 |
data_path = "/tmp/"
|
|
|
|
| 33 |
final_summary = []
|
| 34 |
for x in range(0,len(text)-1256,1256):
|
| 35 |
text_to_summarize= text[x:x+1256]
|
| 36 |
+
final_summary.append(model.predict(text_to_summarize))
|
| 37 |
|
| 38 |
final_list = list(itertools.chain.from_iterable(final_summary))
|
| 39 |
final_list = ''.join(final_list)
|