Spaces:
Runtime error
Runtime error
File size: 728 Bytes
a38d62a daf0a59 a38d62a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("translation", model="google-t5/t5-base")
def translate(text):
return pipe(text)[0]["translation_text"] # type: ignore
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
spanish = gr.Textbox(label="Spanish")
translate_btn = gr.Button(value="Translate")
with gr.Column():
english = gr.Textbox(label="English")
translate_btn.click(translate, inputs=spanish, outputs=english, api_name="translate-to-english")
examples = gr.Examples(examples=["Que pene tan grande tienes.", "Estás tomando anticonceptivos, ¿verdad?"],
inputs=[spanish])
demo.launch()
|