Sadem-12 commited on
Commit
cea8fc4
·
verified ·
1 Parent(s): 16c0b4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -3,13 +3,17 @@ from transformers import pipeline
3
 
4
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
 
6
- def summarize_text(text):
7
- summary = summarizer(text, min_length=10, max_length=100)
8
  return summary[0]['summary_text']
9
 
10
  interface = gr.Interface(
11
  fn=summarize_text,
12
- inputs=gr.Textbox(label="Enter Text", lines=10, placeholder="Paste your long text here..."),
 
 
 
 
13
  outputs=gr.Textbox(label="Summarized Text"),
14
  title="Text Summarizer",
15
  description="This app uses the BART model to summarize your text into a concise form with a minimum of 10 tokens and a maximum of 100 tokens."
 
3
 
4
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
 
6
+ def summarize_text(text, min_len, max_len):
7
+ summary = summarizer(text, min_length=min_len, max_length=max_len)
8
  return summary[0]['summary_text']
9
 
10
  interface = gr.Interface(
11
  fn=summarize_text,
12
+ inputs=[
13
+ gr.Textbox(label="Enter Text", lines=10, placeholder="Paste your long text here..."),
14
+ gr.Slider(label="Min Length", minimum=10, maximum=50, step=1, value=10),
15
+ gr.Slider(label="Max Length", minimum=50, maximum=100, step=1, value=100)
16
+ ],
17
  outputs=gr.Textbox(label="Summarized Text"),
18
  title="Text Summarizer",
19
  description="This app uses the BART model to summarize your text into a concise form with a minimum of 10 tokens and a maximum of 100 tokens."