Spaces:
Sleeping
Sleeping
import gradio as gr | |
# def greet(name): | |
# return "Hello " + name + "!!" | |
# iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
# iface.launch() | |
from transformers import pipeline | |
nlp = pipeline("sentiment-analysis") | |
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.inputs.Textbox(lines=10, placeholder= "Enter a text to summurize ..."), | |
outputs= "text") | |
iface.launch() | |