Diako1 commited on
Commit
2ad382a
1 Parent(s): dffcbd8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ summarizer = pipeline("summarization", model="t4-base", tokenizer="t5-base", framework="tf")
5
+
6
+ def translate(text):
7
+ text = text.replace("\n", "")
8
+ text = text.replace("\r", "")
9
+ text = text.replace(" ", "")
10
+ text = text.replace("&", "")
11
+ text = text.replace("'", "")
12
+ text = text.replace(""", "")
13
+ result = summarizer(text, min_length=99, tructation=True, max_length=200)
14
+ return result[-1]['summary_text']
15
+
16
+ iface = gr.Interface(
17
+ fn=translate,
18
+ inputs=gr.inputs.Textbox(lines=9, label="Text", placeholder="Enter text here..."),
19
+ outputs="text"
20
+ )
21
+ iface.launch()