File size: 702 Bytes
58e27c4
da2572e
1b33ade
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
da2572e
1b33ade
 
 
58e27c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()