PirateXX commited on
Commit
984fb40
·
verified ·
1 Parent(s): d44ac17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -12,13 +12,13 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
12
  model = model.to(device)
13
 
14
 
15
- nltk.download('punkt')
16
- nltk.download('brown')
17
- nltk.download('wordnet')
18
- nltk.download('omw-1.4')
19
 
20
- from nltk.corpus import wordnet as wn
21
- from nltk.tokenize import sent_tokenize
22
 
23
  def set_seed(seed: int):
24
  random.seed(seed)
@@ -28,12 +28,12 @@ def set_seed(seed: int):
28
 
29
  set_seed(42)
30
 
31
- def postprocesstext (content):
32
- final=""
33
- for sent in sent_tokenize(content):
34
- sent = sent.capitalize()
35
- final = final +" "+sent
36
- return final
37
 
38
  def summarizer(text):
39
  text = text.strip().replace("\n"," ")
@@ -56,7 +56,7 @@ def summarizer(text):
56
 
57
  dec = [tokenizer.decode(ids,skip_special_tokens=True) for ids in outs]
58
  summary = dec[0]
59
- summary = postprocesstext(summary)
60
  summary= summary.strip()
61
 
62
  return summary
 
12
  model = model.to(device)
13
 
14
 
15
+ # nltk.download('punkt')
16
+ # nltk.download('brown')
17
+ # nltk.download('wordnet')
18
+ # nltk.download('omw-1.4')
19
 
20
+ # from nltk.corpus import wordnet as wn
21
+ # from nltk.tokenize import sent_tokenize
22
 
23
  def set_seed(seed: int):
24
  random.seed(seed)
 
28
 
29
  set_seed(42)
30
 
31
+ # def postprocesstext (content):
32
+ # final=""
33
+ # for sent in sent_tokenize(content):
34
+ # sent = sent.capitalize()
35
+ # final = final +" "+sent
36
+ # return final
37
 
38
  def summarizer(text):
39
  text = text.strip().replace("\n"," ")
 
56
 
57
  dec = [tokenizer.decode(ids,skip_special_tokens=True) for ids in outs]
58
  summary = dec[0]
59
+ #summary = postprocesstext(summary)
60
  summary= summary.strip()
61
 
62
  return summary