Spaces:
Runtime error
Runtime error
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() | |