fabianad commited on
Commit
e5666c0
·
verified ·
1 Parent(s): 2ec8460

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -1,22 +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
- # Define the function to summarize text
8
  def summarize_text(text):
9
- summary = summarizer(text, max_length=150, min_length=30, do_sample=False)
10
- return summary[0]["summary_text"]
11
 
12
- # Create the Gradio interface
13
  iface = gr.Interface(
14
  fn=summarize_text,
15
- inputs=gr.Textbox(lines=10, placeholder="Enter text to summarize..."),
16
  outputs="text",
17
  title="Text Summarization Chatbot",
18
  description="Enter a long text passage, and the chatbot will summarize it for you using the 'facebook/bart-large-cnn' model.",
19
- theme="compact"
20
  )
21
 
22
  # Launch the app
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
4
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
 
 
6
  def summarize_text(text):
7
+ summary = summarizer(text, max_length=100, min_length=30, do_sample=False)
8
+ return summary[0]['summary_text']
9
 
 
10
  iface = gr.Interface(
11
  fn=summarize_text,
12
+ inputs=gr.Textbox(lines=5, placeholder="Enter text to summarize..."),
13
  outputs="text",
14
  title="Text Summarization Chatbot",
15
  description="Enter a long text passage, and the chatbot will summarize it for you using the 'facebook/bart-large-cnn' model.",
 
16
  )
17
 
18
  # Launch the app