abdulmatinomotoso commited on
Commit
a67e3e7
1 Parent(s): 664d61b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -9,9 +9,10 @@ from gradio.mix import Parallel
9
  from transformers import pipeline
10
  import numpy as np
11
 
 
12
  # Defining a function to read in the text file
13
  def read_in_text(url):
14
- with open(url, 'r') as file:
15
  article = file.read()
16
 
17
  return article
@@ -22,6 +23,7 @@ from transformers import BartTokenizer, BartForConditionalGeneration
22
  model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn")
23
  tokenizer = BartTokenizer.from_pretrained("facebook/bart-large-cnn")
24
 
 
25
  #Defining a function to get the summary of the article
26
  def final_summary(file):
27
 
@@ -39,10 +41,10 @@ def final_summary(file):
39
  output.append(summary)
40
 
41
  #joining all the summary output together
42
- summary = ' '.join(output)
43
  lines1 = sent_tokenize(summary)
44
  for i in range(len(lines1)):
45
- lines1[i] = "* " + lines1[i].strip().replace(' .', '.')
46
 
47
  summ_bullet1 = "\n".join(lines1)
48
 
 
9
  from transformers import pipeline
10
  import numpy as np
11
 
12
+
13
  # Defining a function to read in the text file
14
  def read_in_text(url):
15
+ with open(URL, "r") as file:
16
  article = file.read()
17
 
18
  return article
 
23
  model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn")
24
  tokenizer = BartTokenizer.from_pretrained("facebook/bart-large-cnn")
25
 
26
+
27
  #Defining a function to get the summary of the article
28
  def final_summary(file):
29
 
 
41
  output.append(summary)
42
 
43
  #joining all the summary output together
44
+ summary = " ".join(output)
45
  lines1 = sent_tokenize(summary)
46
  for i in range(len(lines1)):
47
+ lines1[i] = "* " + lines1[i].strip().replace(" .", ".")
48
 
49
  summ_bullet1 = "\n".join(lines1)
50