saritha5 commited on
Commit
cd3b854
1 Parent(s): 69b46cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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.split())
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.split())
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="count1"),
68
- gr.Number(label="count2")
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,