JLuissp commited on
Commit
91ba568
·
1 Parent(s): 7b34b80

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ for transformers import pipeline
2
+ import gradio as gr
3
+
4
+ summarizer = pipeline('summarization',
5
+ model='t5-base',
6
+ tokenizer='t5-small',
7
+ truncation=True,
8
+ framework='tf')
9
+
10
+ def translate(text):
11
+ text = text.replace('"', '"')
12
+ text = text.replace(''', "'")
13
+ text = text.replace('&',, "&")
14
+ result =summarizer(text, min_lenght=180, truncation=True)
15
+ return result[0]['summary_text']
16
+
17
+ iface = gr.Interface(
18
+ fn = translate,
19
+ inputs = gr.inputs.Textbox(lines=10, placeholder='Enter text to summarize...')
20
+ outputs='Text'
21
+ )
22
+ iface.launch()