varl42 commited on
Commit
bc1bad1
·
1 Parent(s): bcf8e28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -20,15 +20,15 @@ def summarize_text(text):
20
  for i, sentence in enumerate(sentences):
21
  if "Abstract" in sentence:
22
  start = i + 1
23
- end = start + 4
24
  break
25
 
26
  # Extract abstract
27
  abstract = ". ".join(sentences[start:end+1])
28
 
29
  # Load BART model & tokenizer
30
- tokenizer = AutoTokenizer.from_pretrained("google/bigbird-pegasus-large-arxiv")
31
- model = AutoModelForSeq2SeqLM.from_pretrained("google/bigbird-pegasus-large-arxiv")
32
 
33
  # Tokenize abstract
34
  inputs = tokenizer(abstract,
@@ -38,7 +38,7 @@ def summarize_text(text):
38
 
39
  # Generate summary
40
  summary_ids = model.generate(inputs['input_ids'],
41
- num_beams=3,
42
  max_length=50,
43
  min_length=30,
44
  do_sample=False,
 
20
  for i, sentence in enumerate(sentences):
21
  if "Abstract" in sentence:
22
  start = i + 1
23
+ end = start + 5
24
  break
25
 
26
  # Extract abstract
27
  abstract = ". ".join(sentences[start:end+1])
28
 
29
  # Load BART model & tokenizer
30
+ tokenizer = AutoTokenizer.from_pretrained("pszemraj/led-base-book-summary")
31
+ model = AutoModelForSeq2SeqLM.from_pretrained(model="pszemraj/led-base-book-summary")
32
 
33
  # Tokenize abstract
34
  inputs = tokenizer(abstract,
 
38
 
39
  # Generate summary
40
  summary_ids = model.generate(inputs['input_ids'],
41
+ #num_beams=3,
42
  max_length=50,
43
  min_length=30,
44
  do_sample=False,