shahad-b commited on
Commit
7969cb3
·
verified ·
1 Parent(s): 9b5407d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -1,21 +1,18 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the summarization model
5
- summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
6
 
7
- def summarize_text(text):
8
- summary = summarizer(text, min_length=10, max_length=100, do_sample=False)
9
- return summary[0]['summary_text']
10
 
11
- # Create the Gradio interface
12
- iface = gr.Interface(
13
- fn=summarize_text,
14
- inputs=gr.Textbox(label="Enter Text", placeholder="Paste your long text here...", lines=10),
15
  outputs=gr.Textbox(label="Summarized Text"),
16
  title="Text Summarizer",
17
- description="Enter a long piece of text to get a concise summary."
18
  )
19
 
20
- # Launch the interface
21
- iface.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ sum = pipeline("summarization", model="facebook/bart-large-cnn")
 
5
 
6
+ def sumtext(text):
7
+ summary = sum(text, min_length=10, max_length=100, do_sample=False)
8
+ return summary[0]['summary']
9
 
10
+ gr = gr.Interface(
11
+ fn=sumtext,
12
+ inputs=gr.Textbox(label="Enter Text", lines=10),
 
13
  outputs=gr.Textbox(label="Summarized Text"),
14
  title="Text Summarizer",
15
+ description="Provide a lengthy text to receive a brief summary."
16
  )
17
 
18
+ gr.launch()