Update app.py
Browse files
app.py
CHANGED
|
@@ -16,10 +16,6 @@ def translate_en_to_zh(text):
|
|
| 16 |
def swap_text(input_text, output_text):
|
| 17 |
return output_text, input_text
|
| 18 |
|
| 19 |
-
def copy_to_clipboard(output_text):
|
| 20 |
-
pyperclip.copy(output_text)
|
| 21 |
-
return "Text copied!"
|
| 22 |
-
|
| 23 |
with gr.Blocks() as demo:
|
| 24 |
input_text = gr.Textbox(lines=2, placeholder="Enter text here...", label="Input Text")
|
| 25 |
output_text = gr.Textbox(lines=2, label="Translated Text")
|
|
@@ -28,12 +24,9 @@ with gr.Blocks() as demo:
|
|
| 28 |
zh_to_en_button = gr.Button("Chinese to English")
|
| 29 |
en_to_zh_button = gr.Button("English to Chinese")
|
| 30 |
swap_button = gr.Button("Swap")
|
| 31 |
-
copy_button = gr.Button("Copy")
|
| 32 |
|
| 33 |
zh_to_en_button.click(translate_zh_to_en, inputs=input_text, outputs=output_text)
|
| 34 |
en_to_zh_button.click(translate_en_to_zh, inputs=input_text, outputs=output_text)
|
| 35 |
swap_button.click(swap_text, inputs=[input_text, output_text], outputs=[input_text, output_text])
|
| 36 |
-
copy_button.click(copy_to_clipboard, inputs=[output_text], outputs=[])
|
| 37 |
-
|
| 38 |
|
| 39 |
demo.launch()
|
|
|
|
| 16 |
def swap_text(input_text, output_text):
|
| 17 |
return output_text, input_text
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
with gr.Blocks() as demo:
|
| 20 |
input_text = gr.Textbox(lines=2, placeholder="Enter text here...", label="Input Text")
|
| 21 |
output_text = gr.Textbox(lines=2, label="Translated Text")
|
|
|
|
| 24 |
zh_to_en_button = gr.Button("Chinese to English")
|
| 25 |
en_to_zh_button = gr.Button("English to Chinese")
|
| 26 |
swap_button = gr.Button("Swap")
|
|
|
|
| 27 |
|
| 28 |
zh_to_en_button.click(translate_zh_to_en, inputs=input_text, outputs=output_text)
|
| 29 |
en_to_zh_button.click(translate_en_to_zh, inputs=input_text, outputs=output_text)
|
| 30 |
swap_button.click(swap_text, inputs=[input_text, output_text], outputs=[input_text, output_text])
|
|
|
|
|
|
|
| 31 |
|
| 32 |
demo.launch()
|