SAB03 commited on
Commit
2f0968f
·
1 Parent(s): 7e695b3

added app.py

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