Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
sum = 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(''', "'")
|
9 |
+
text = text.replace('&', '&')
|
10 |
+
result = sum(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 and hit enter")
|
16 |
+
outputs="text"
|
17 |
+
)
|
18 |
+
|
19 |
+
iface.launch()
|
20 |
+
|