File size: 698 Bytes
d2cddbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from transformers import pipeline

pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-et-en")

def main(in_text):
  print(in_text)
  answer = pipe(in_text)
  print(answer)
  return answer[0]["translation_text"]

with gr.Blocks() as demo:
  gr.Markdown("""# Translation Engine!""")
  with gr.Row():
    with gr.Column():
      text1 = gr.Textbox(
            label="Input Text",
            lines=1,
        )
      output = gr.Textbox(label="Output Text")
      b1 = gr.Button("Translate!")
      b1.click(main, inputs=[text1], outputs=output)
  gr.Markdown("""#### powered by [Tassle](https://bit.ly/3LXMklV)""")


if __name__ == "__main__":
    demo.launch(debug=True)