Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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()
|