add reqments & max length
Browse files- ebart.py +5 -2
- requirements.txt +1 -0
ebart.py
CHANGED
@@ -55,8 +55,11 @@ class PegasusSummarizer:
|
|
55 |
|
56 |
@spaces.GPU
|
57 |
def generate_summary(text, max_length=180, min_length=64):
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
60 |
|
61 |
if __name__ == "__main__":
|
62 |
text = (
|
|
|
55 |
|
56 |
@spaces.GPU
|
57 |
def generate_summary(text, max_length=180, min_length=64):
|
58 |
+
if(len(text)< max_length):
|
59 |
+
return text
|
60 |
+
else:
|
61 |
+
summarizer = PegasusSummarizer()
|
62 |
+
return summarizer.generate_summary(text, max_length, min_length)
|
63 |
|
64 |
if __name__ == "__main__":
|
65 |
text = (
|
requirements.txt
CHANGED
@@ -2,3 +2,4 @@ transformers
|
|
2 |
torch
|
3 |
scikit-learn
|
4 |
pandas
|
|
|
|
2 |
torch
|
3 |
scikit-learn
|
4 |
pandas
|
5 |
+
tokenizers_pegasus
|