Jordan Myers
commited on
Commit
•
a96c965
1
Parent(s):
d7779d6
blocks test
Browse files
app.py
CHANGED
@@ -40,25 +40,30 @@ def translate(text, src_lang, tgt_lang, candidates:int):
|
|
40 |
|
41 |
return output
|
42 |
|
43 |
-
app = gr.Interface(
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
# A simple English / toki pona Neural Machine Translation App!
|
63 |
|
64 |
### toki a! 💬
|
@@ -89,6 +94,24 @@ app = gr.Interface(
|
|
89 |
|
90 |
If you wish to contribute, please simply add high quality and diverse translations to Tatoeba!
|
91 |
""")
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
app.launch()
|
|
|
40 |
|
41 |
return output
|
42 |
|
43 |
+
# app = gr.Interface(
|
44 |
+
# fn=translate,
|
45 |
+
# inputs=[
|
46 |
+
# gr.components.Textbox(label="Text"),
|
47 |
+
# gr.components.Dropdown(label="Source Language", choices=list(LANG_CODES.keys())),
|
48 |
+
# gr.components.Dropdown(label="Target Language", choices=list(LANG_CODES.keys())),
|
49 |
+
# gr.Slider(label="Number of return sequences", value=3, minimum=1, maximum=12, step=1)
|
50 |
+
# ],
|
51 |
+
# outputs=["text"],
|
52 |
+
# examples=[
|
53 |
+
# ["Welcome to my translation app.", "English", "toki pona", 3],
|
54 |
+
# ["Its not always perfect, but its pretty okay!", "English", "toki pona", 3],
|
55 |
+
# ["ilo pi ante toki ni li pona a!", "toki pona", "English", 3],
|
56 |
+
# ["kijetesantakalu li pona", "toki pona", "English", 3],
|
57 |
+
# ["mi li toki e toki pona", "toki pona", "toki pona", 3]
|
58 |
+
# ],
|
59 |
+
# cache_examples=False,
|
60 |
+
# title="English / toki pona Translation"
|
61 |
+
# )
|
62 |
+
|
63 |
+
app = gr.Blocks()
|
64 |
+
|
65 |
+
with app:
|
66 |
+
gr.Markdown("""
|
67 |
# A simple English / toki pona Neural Machine Translation App!
|
68 |
|
69 |
### toki a! 💬
|
|
|
94 |
|
95 |
If you wish to contribute, please simply add high quality and diverse translations to Tatoeba!
|
96 |
""")
|
97 |
+
gr.Interface(
|
98 |
+
fn=translate,
|
99 |
+
inputs=[
|
100 |
+
gr.components.Textbox(label="Text"),
|
101 |
+
gr.components.Dropdown(label="Source Language", choices=list(LANG_CODES.keys())),
|
102 |
+
gr.components.Dropdown(label="Target Language", choices=list(LANG_CODES.keys())),
|
103 |
+
gr.Slider(label="Number of return sequences", value=3, minimum=1, maximum=12, step=1)
|
104 |
+
],
|
105 |
+
outputs=["text"],
|
106 |
+
examples=[
|
107 |
+
["Welcome to my translation app.", "English", "toki pona", 3],
|
108 |
+
["Its not always perfect, but its pretty okay!", "English", "toki pona", 3],
|
109 |
+
["ilo pi ante toki ni li pona a!", "toki pona", "English", 3],
|
110 |
+
["kijetesantakalu li pona", "toki pona", "English", 3],
|
111 |
+
["mi li toki e toki pona", "toki pona", "toki pona", 3]
|
112 |
+
],
|
113 |
+
cache_examples=False,
|
114 |
+
title="English / toki pona Translation"
|
115 |
+
)
|
116 |
|
117 |
app.launch()
|