Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-
|
5 |
|
6 |
def main(in_text):
|
7 |
print(in_text)
|
@@ -10,7 +10,7 @@ def main(in_text):
|
|
10 |
return answer[0]["translation_text"]
|
11 |
|
12 |
with gr.Blocks() as demo:
|
13 |
-
gr.Markdown("""# Translation Engine
|
14 |
with gr.Row():
|
15 |
with gr.Column():
|
16 |
text1 = gr.Textbox(
|
@@ -18,9 +18,9 @@ with gr.Blocks() as demo:
|
|
18 |
lines=1,
|
19 |
)
|
20 |
output = gr.Textbox(label="Output Text")
|
21 |
-
b1 = gr.Button("Translate
|
22 |
b1.click(main, inputs=[text1], outputs=output)
|
23 |
-
gr.Markdown("""#### powered by
|
24 |
|
25 |
|
26 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-zh")
|
5 |
|
6 |
def main(in_text):
|
7 |
print(in_text)
|
|
|
10 |
return answer[0]["translation_text"]
|
11 |
|
12 |
with gr.Blocks() as demo:
|
13 |
+
gr.Markdown("""# Translation Engine""")
|
14 |
with gr.Row():
|
15 |
with gr.Column():
|
16 |
text1 = gr.Textbox(
|
|
|
18 |
lines=1,
|
19 |
)
|
20 |
output = gr.Textbox(label="Output Text")
|
21 |
+
b1 = gr.Button("Translate")
|
22 |
b1.click(main, inputs=[text1], outputs=output)
|
23 |
+
gr.Markdown("""#### powered by OpenCSG""")
|
24 |
|
25 |
|
26 |
if __name__ == "__main__":
|