Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,12 +16,11 @@ def lex_rank(in_text, threshold=None , model_in = 'KBLab/sentence-bert-swedish-c
|
|
16 |
|
17 |
model = SentenceTransformer(model_in)
|
18 |
#Split the document into sentences
|
19 |
-
sentences = nltk.sent_tokenize(
|
20 |
-
|
21 |
#Compute the sentence embeddings
|
22 |
embeddings = model.encode(sentences, convert_to_tensor=True)
|
23 |
cos_scores = util.cos_sim(embeddings, embeddings).cpu().numpy()
|
24 |
-
print("2")
|
25 |
|
26 |
#Compute the centrality for each sentence
|
27 |
centrality_scores = degree_centrality_scores(cos_scores, threshold=threshold)
|
|
|
16 |
|
17 |
model = SentenceTransformer(model_in)
|
18 |
#Split the document into sentences
|
19 |
+
sentences = nltk.sent_tokenize(in_text, language=language)
|
20 |
+
|
21 |
#Compute the sentence embeddings
|
22 |
embeddings = model.encode(sentences, convert_to_tensor=True)
|
23 |
cos_scores = util.cos_sim(embeddings, embeddings).cpu().numpy()
|
|
|
24 |
|
25 |
#Compute the centrality for each sentence
|
26 |
centrality_scores = degree_centrality_scores(cos_scores, threshold=threshold)
|