Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ from string import punctuation
|
|
17 |
# Prediction
|
18 |
def prediction(text):
|
19 |
doc = nlp(text)
|
20 |
-
len1 = len(text
|
21 |
tokens = [token.text for token in doc]
|
22 |
word_frequencies = {}
|
23 |
for word in doc:
|
@@ -41,7 +41,7 @@ def prediction(text):
|
|
41 |
sentence_scores[sent] += word_frequencies[word.text.lower()]
|
42 |
select_length = int(len(sentence_tokens)*0.3)
|
43 |
summary = nlargest(select_length, sentence_scores, key = sentence_scores.get)
|
44 |
-
len2 = len(summary
|
45 |
return summary,len1,len2
|
46 |
|
47 |
#text = """
|
@@ -64,8 +64,8 @@ def prediction(text):
|
|
64 |
#print(summary)
|
65 |
outputs = [
|
66 |
gr.Textbox(lines =5,label = "Summarization of text"),
|
67 |
-
gr.Number(label="
|
68 |
-
gr.Number(label="
|
69 |
]
|
70 |
demo_app = gr.Interface(
|
71 |
fn=prediction,
|
|
|
17 |
# Prediction
|
18 |
def prediction(text):
|
19 |
doc = nlp(text)
|
20 |
+
len1 = len(text)
|
21 |
tokens = [token.text for token in doc]
|
22 |
word_frequencies = {}
|
23 |
for word in doc:
|
|
|
41 |
sentence_scores[sent] += word_frequencies[word.text.lower()]
|
42 |
select_length = int(len(sentence_tokens)*0.3)
|
43 |
summary = nlargest(select_length, sentence_scores, key = sentence_scores.get)
|
44 |
+
len2 = len(summary)
|
45 |
return summary,len1,len2
|
46 |
|
47 |
#text = """
|
|
|
64 |
#print(summary)
|
65 |
outputs = [
|
66 |
gr.Textbox(lines =5,label = "Summarization of text"),
|
67 |
+
gr.Number(label="Word Count of given Text"),
|
68 |
+
gr.Number(label="Word Count of Summarized Text")
|
69 |
]
|
70 |
demo_app = gr.Interface(
|
71 |
fn=prediction,
|