evals / app.py
drixo's picture
Update app.py
572d241 verified
raw
history blame contribute delete
463 Bytes
import gradio as gr
from transformers import pipeline
translator = pipeline(
"text2text-generation",
model="t5-small"
)
def translate(text):
return translator(
"translate English to Spanish: " + text,
max_length=64
)[0]["generated_text"]
demo = gr.Interface(
fn=translate,
inputs=gr.Textbox(label="English Input"),
outputs=gr.Textbox(label="Spanish Output"),
title="Working Demo (T5 base model)"
)
demo.launch()