seemasaharann commited on
Commit
1caf530
1 Parent(s): a28801e

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,8 +1,10 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
 
 
4
  summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-small", truncation=True, framework="tf")
5
 
 
6
  def translate(text):
7
  text = text.replace('"', '"')
8
  text = text.replace(''', "'")
@@ -10,9 +12,12 @@ def translate(text):
10
  result = summarizer(text, min_length=180, truncation=True)
11
  return result[0]['summary_text']
12
 
 
13
  iface = gr.Interface(
14
  fn=translate,
15
- inputs = gr.inputs.Textbox(lines=10, placeholder="Enter text to summarize..."),
16
- outputs="text"
17
  )
18
- iface.launch()
 
 
 
1
  from transformers import pipeline
2
  import gradio as gr
3
 
4
+ # Define the summarizer using the transformers pipeline
5
  summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-small", truncation=True, framework="tf")
6
 
7
+ # Define the function to process the text and return the summary
8
  def translate(text):
9
  text = text.replace('"', '"')
10
  text = text.replace(''', "'")
 
12
  result = summarizer(text, min_length=180, truncation=True)
13
  return result[0]['summary_text']
14
 
15
+ # Create the Gradio interface with updated syntax
16
  iface = gr.Interface(
17
  fn=translate,
18
+ inputs=gr.Textbox(lines=10, placeholder="Enter text to summarize..."),
19
+ outputs=gr.Textbox()
20
  )
21
+
22
+ # Launch the Gradio app
23
+ iface.launch()