Spaces:
Build error
Build error
hellopahe
commited on
Commit
·
534bdc5
1
Parent(s):
3228ae3
fix req file
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ class SummaryExtractor(object):
|
|
22 |
|
23 |
def extract(self, content: str) -> str:
|
24 |
print(content)
|
25 |
-
return str(self.text2text_genr(content, do_sample=False, num_return_sequences=3)[0]["generated_text"])
|
26 |
|
27 |
class LexRank(object):
|
28 |
def __init__(self):
|
@@ -40,7 +40,19 @@ class LexRank(object):
|
|
40 |
|
41 |
# We argsort so that the first element is the sentence with the highest score
|
42 |
most_central_sentence_indices = numpy.argsort(-centrality_scores)
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# ---===--- worker instances ---===---
|
46 |
t_randeng = SummaryExtractor()
|
|
|
22 |
|
23 |
def extract(self, content: str) -> str:
|
24 |
print(content)
|
25 |
+
return str(self.text2text_genr(content, min_length=20, do_sample=False, num_return_sequences=3)[0]["generated_text"])
|
26 |
|
27 |
class LexRank(object):
|
28 |
def __init__(self):
|
|
|
40 |
|
41 |
# We argsort so that the first element is the sentence with the highest score
|
42 |
most_central_sentence_indices = numpy.argsort(-centrality_scores)
|
43 |
+
|
44 |
+
num = 500
|
45 |
+
ptr = 0
|
46 |
+
for index, sentence in enumerate(sentences):
|
47 |
+
num -= len(sentence)
|
48 |
+
if num < 0 and index > 0:
|
49 |
+
ptr = index - 1
|
50 |
+
break
|
51 |
+
if num < 0 and index == 0:
|
52 |
+
ptr = index
|
53 |
+
break
|
54 |
+
|
55 |
+
return list(sentences[index] for index in most_central_sentence_indices[0: ptr])
|
56 |
|
57 |
# ---===--- worker instances ---===---
|
58 |
t_randeng = SummaryExtractor()
|