demo-space / app.py
Esml's picture
minor modification on gradio functionality
da2572e
raw
history blame contribute delete
702 Bytes
import gradio as gr
from transformers import pipeline
summurizer = pipeline( "summarization",
model="t5-base",
tokenizer = "t5-small",
truncuation = True,
framework ="tf" )
def translate(text):
text = text.replace('"', '"')
text = text.replace('&apos', "'")
text = text.replace('&', '&')
result = summurizer(text, min_length= 180, truncuation=True)
return result[0]["summary_text"]
iface = gr.Interface( fn=translate,
inputs= gr.Textbox(lines=10, placeholder= "Enter a text to summurize ..."),
outputs= "text")
iface.launch()