File size: 571 Bytes
57382cd
8350d8f
57382cd
65fe72e
57382cd
6f788af
57382cd
3639318
57382cd
 
 
 
d5fa99f
57382cd
b4d4270
6ff9251
3639318
57382cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import pipeline 
import gradio as gr 

summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-small", truncation=True)

def traslate(text):
    text = text.replace('"', '"')
    text = text.replace(''', "'")
    text = text.replace('&', "&")
    result = summarizer(text, min_length=180, truncation=True)
    return result[0]["summary_text"]

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