space-demo / app.py
Diako1's picture
Create app.py
2ad382a
raw
history blame
675 Bytes
from transformers import pipeline
import gradio as gr
summarizer = pipeline("summarization", model="t4-base", tokenizer="t5-base", framework="tf")
def translate(text):
text = text.replace("\n", "")
text = text.replace("\r", "")
text = text.replace(" ", "")
text = text.replace("&", "")
text = text.replace("'", "")
text = text.replace(""", "")
result = summarizer(text, min_length=99, tructation=True, max_length=200)
return result[-1]['summary_text']
iface = gr.Interface(
fn=translate,
inputs=gr.inputs.Textbox(lines=9, label="Text", placeholder="Enter text here..."),
outputs="text"
)
iface.launch()