pcasale commited on
Commit
42ebc03
·
verified ·
1 Parent(s): 4e4cd39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -5,7 +5,12 @@ import gradio as gr
5
  summariser = pipeline("summarization", model="facebook/bart-large-cnn")
6
 
7
  def summarise(text):
8
- summary = summariser(text, max_length=150, min_length=40, do_sample=False)[0]["summary_text"]
 
 
 
 
 
9
  return summary
10
 
11
  # Two example passages for quick testing
@@ -37,6 +42,17 @@ Two sample texts are provided below for immediate experimentation."""
37
  )
38
 
39
  output_box = gr.Textbox(
40
- lines=10, # Increased height for the summary output
41
  label="Summary"
 
 
 
 
 
 
 
 
 
 
42
 
 
 
5
  summariser = pipeline("summarization", model="facebook/bart-large-cnn")
6
 
7
  def summarise(text):
8
+ summary = summariser(
9
+ text,
10
+ max_length=150,
11
+ min_length=40,
12
+ do_sample=False
13
+ )[0]["summary_text"]
14
  return summary
15
 
16
  # Two example passages for quick testing
 
42
  )
43
 
44
  output_box = gr.Textbox(
45
+ lines=10,
46
  label="Summary"
47
+ )
48
+
49
+ run_btn = gr.Button("Summarise")
50
+ run_btn.click(summarise, inputs=input_box, outputs=output_box)
51
+
52
+ gr.Examples(
53
+ examples=example_texts,
54
+ inputs=input_box,
55
+ label="Example Texts"
56
+ )
57
 
58
+ demo.launch()