First build
Browse files- app.py +13 -14
- requirements.txt +3 -0
app.py
CHANGED
|
@@ -10,16 +10,16 @@ LANGS = {
|
|
| 10 |
'Russian': 'rus_Cyrl',
|
| 11 |
'Belarusian': 'bel_Cyrl',
|
| 12 |
'Ukrainian': 'ukr_Cyrl',
|
| 13 |
-
'Bulgarian': 'bul_Cyrl',
|
| 14 |
-
'Macedonian': 'mkd_Cyrl',
|
| 15 |
-
'Serbian': 'srp_Cyrl',
|
| 16 |
-
'Croatian': 'hrv_Latn',
|
| 17 |
-
'Bosnian': 'bos_Latn',
|
| 18 |
-
'Slovenian': 'slv_Latn',
|
| 19 |
-
'Slovak': 'slk_Latn',
|
| 20 |
-
'Czech': 'ces_Latn',
|
| 21 |
'Polish': 'pol_Latn',
|
| 22 |
'Silesian': 'szl_Latn',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
'Esperanto': 'epo_Latn',
|
| 24 |
'German': 'deu_Latn',
|
| 25 |
'French': 'fra_Latn',
|
|
@@ -55,18 +55,17 @@ else:
|
|
| 55 |
return output
|
| 56 |
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
with demo:
|
| 61 |
gr.Markdown("This is a modified version of the original [NLLB-Translator](https://huggingface.co/spaces/Narrativaai/NLLB-Translator) space")
|
| 62 |
with gr.Row():
|
| 63 |
lang_input = gr.components.Dropdown(label="From", choices=list(LANGS.keys()), value='English')
|
| 64 |
lang_output = gr.components.Dropdown(label="To", choices=list(LANGS.keys()), value='Interslavic')
|
| 65 |
with gr.Row().style(equal_height=True):
|
| 66 |
-
text_input = gr.components.Textbox(label="Text", lines=
|
| 67 |
-
text_output = gr.components.Textbox(label="Result", lines=
|
| 68 |
button = gr.Button("Translate")
|
| 69 |
|
| 70 |
button.click(translate, inputs=[text_input, lang_input, lang_output], outputs=text_output)
|
| 71 |
|
| 72 |
-
demo.launch()
|
|
|
|
| 10 |
'Russian': 'rus_Cyrl',
|
| 11 |
'Belarusian': 'bel_Cyrl',
|
| 12 |
'Ukrainian': 'ukr_Cyrl',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
'Polish': 'pol_Latn',
|
| 14 |
'Silesian': 'szl_Latn',
|
| 15 |
+
'Czech': 'ces_Latn',
|
| 16 |
+
'Slovak': 'slk_Latn',
|
| 17 |
+
'Slovenian': 'slv_Latn',
|
| 18 |
+
'Croatian': 'hrv_Latn',
|
| 19 |
+
'Bosnian': 'bos_Latn',
|
| 20 |
+
'Serbian': 'srp_Cyrl',
|
| 21 |
+
'Macedonian': 'mkd_Cyrl',
|
| 22 |
+
'Bulgarian': 'bul_Cyrl',
|
| 23 |
'Esperanto': 'epo_Latn',
|
| 24 |
'German': 'deu_Latn',
|
| 25 |
'French': 'fra_Latn',
|
|
|
|
| 55 |
return output
|
| 56 |
|
| 57 |
|
| 58 |
+
with gr.Blocks() as demo:
|
| 59 |
+
gr.Markdown("# Interslavic translator via NLLB200")
|
|
|
|
| 60 |
gr.Markdown("This is a modified version of the original [NLLB-Translator](https://huggingface.co/spaces/Narrativaai/NLLB-Translator) space")
|
| 61 |
with gr.Row():
|
| 62 |
lang_input = gr.components.Dropdown(label="From", choices=list(LANGS.keys()), value='English')
|
| 63 |
lang_output = gr.components.Dropdown(label="To", choices=list(LANGS.keys()), value='Interslavic')
|
| 64 |
with gr.Row().style(equal_height=True):
|
| 65 |
+
text_input = gr.components.Textbox(label="Text", lines=5, placeholder="Your text")
|
| 66 |
+
text_output = gr.components.Textbox(label="Result", lines=5, placeholder="Translation...")
|
| 67 |
button = gr.Button("Translate")
|
| 68 |
|
| 69 |
button.click(translate, inputs=[text_input, lang_input, lang_output], outputs=text_output)
|
| 70 |
|
| 71 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
git+https://github.com/huggingface/transformers
|
| 2 |
+
gradio
|
| 3 |
+
torch
|