File size: 493 Bytes
ca51f45
 
e8e594d
ca51f45
 
 
a7a6b50
ca51f45
 
 
6b63a5c
ca51f45
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from transformers import pipeline 
import gradio as gr
summarizer = pipeline("summarization")

def translate(text):
    text = text.replace(""",'"').replace("'","'").replace("&","&")
    result = summarizer(text, max_length=45, clean_up_tokenization_spaces=True)
    return result[0]["summary_text"]

iface = gr.Interface(fn=translate,
                    inputs = gr.Textbox(lines=10,placeholder="Enter text to summarize..."),
                    outputs="text")

iface.launch()