MLDemo / app.py
Bin ZHANG
bug fix
8392562
raw
history blame
515 Bytes
from transformers import pipeline
import gradio as gr
summarizer = pipeline("summarization")
def translate(text):
text = text.replace(""",'"').replace("'","'").replace("&","&")
result = summarizer(text,min_length=180,truncation=True,clean_up_tokenization_spaces=True)
return result[0]["summary_text"]
iface = gr.Interface(fn=translate,
inputs = gr.inputs.Textbox(lines=10,placeholder="Enter text to summarize..."),
outputs="text")
iface.launch()