File size: 803 Bytes
e274728
 
dc494ca
e274728
dc494ca
e274728
 
 
dc494ca
e274728
 
 
 
 
 
 
 
 
dc494ca
 
 
 
 
e274728
 
 
 
 
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
26
27
28
import gradio as gr

#from transformers import pipeline

#pipe = pipeline("translation", model="t5-base")


def translate(text):
    return #pipe(text)[0]["translation_text"]


with gr.Blocks() as demo:
    with gr.Row():
        with gr.Column():
            english = gr.Textbox(label="English text")
            translate_btn = gr.Button(value="Translate")
        with gr.Column():
            german = gr.Textbox(label="German Text")
    with gr.Row():
        img1=gr.Image()
        img2=gr.Image()
        img3=gr.Image()
        
    translate_btn.click(translate, inputs=english, outputs=german, api_name="translate-to-german")
    examples = gr.Examples(examples=["I went to the supermarket yesterday.", "Helen is a good swimmer."],
                           inputs=[english])

demo.launch()