ashutoshzade commited on
Commit
0a6da1c
1 Parent(s): 7b46147

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -1,15 +1,23 @@
1
  import gradio as gr
 
2
  from transformers import pipeline
3
 
4
- #get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6")
5
- summarizer = pipeline("summarization", model="Falconsai/text_summarization")
6
 
7
- print(summarizer(ARTICLE, max_length=230, min_length=30, do_sample=False))
 
8
 
9
  def summarize(input):
10
- #output = get_completion(input)
11
- output = summarizer(ARTICLE, max_length=230, min_length=30, do_sample=False)
12
- #return output[0]['summary_text']
 
 
 
 
 
 
 
13
  return output
14
 
15
  demo = gr.Interface(fn=summarize, inputs="text", outputs="text")
 
1
  import gradio as gr
2
+ import torch
3
  from transformers import pipeline
4
 
5
+ summarizer = pipeline("summarization", "jordiclive/flan-t5-3b-summarizer", torch_dtype=torch.bfloat16)
 
6
 
7
+ raw_document = 'You must be 18 years old to live or work in New York State...'
8
+ prompt = "Produce an article summary of the following news article:"
9
 
10
  def summarize(input):
11
+
12
+ output = summarizer(
13
+ f"{prompt} {input}",
14
+ num_beams=5,
15
+ min_length=5,
16
+ no_repeat_ngram_size=3,
17
+ truncation=True,
18
+ max_length=512,
19
+ )
20
+
21
  return output
22
 
23
  demo = gr.Interface(fn=summarize, inputs="text", outputs="text")