Master0fNone commited on
Commit
f3c0ca7
·
verified ·
1 Parent(s): 446e2f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,4 +1,4 @@
1
- # Import libraries
2
  import gradio as gr
3
  from transformers import AutoModel, AutoProcessor
4
  import torch
@@ -13,7 +13,7 @@ model_name = "facebook/bart-large-cnn"
13
  # Create a summarization pipeline with Facebook Bart
14
  summarizer = pipeline("summarization", model=model_name)
15
 
16
- # Define a function that takes a text and returns a summary
17
  def summarize(input_text):
18
  summary = summarizer(input_text, max_length=100, min_length=10, do_sample=False)
19
  return summary[0]["summary_text"]
@@ -21,8 +21,8 @@ def summarize(input_text):
21
  # Create a Gradio interface
22
  interface = gr.Interface(
23
  fn=summarize, # the function to wrap
24
- inputs=gr.Textbox(lines=10, label="Input Text"), # the input component
25
- outputs=gr.Textbox(label="Summary") # the output component
26
  )
27
 
28
  # Launch the interface
 
1
+ # Imports
2
  import gradio as gr
3
  from transformers import AutoModel, AutoProcessor
4
  import torch
 
13
  # Create a summarization pipeline with Facebook Bart
14
  summarizer = pipeline("summarization", model=model_name)
15
 
16
+ # Define a function that takes input and returns summary
17
  def summarize(input_text):
18
  summary = summarizer(input_text, max_length=100, min_length=10, do_sample=False)
19
  return summary[0]["summary_text"]
 
21
  # Create a Gradio interface
22
  interface = gr.Interface(
23
  fn=summarize, # the function to wrap
24
+ inputs=gr.Textbox(lines=10, label="Input Text"),
25
+ outputs=gr.Textbox(label="Summary")
26
  )
27
 
28
  # Launch the interface