Spaces:
Runtime error
Runtime error
cointegrated
commited on
Commit
•
51fb7cc
1
Parent(s):
ddd805d
add quality feedback
Browse files- .gitignore +1 -0
- app.py +25 -0
.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1 |
.idea
|
|
|
|
1 |
.idea
|
2 |
+
flagged/
|
app.py
CHANGED
@@ -12,6 +12,13 @@ MODEL_URL_MUL_MYV = 'slone/mbart-large-51-mul-myv-v1'
|
|
12 |
MODEL_URL_LANGID = 'https://huggingface.co/slone/fastText-LID-323/resolve/main/lid.323.ftz'
|
13 |
MODEL_PATH_LANGID = 'lid.323.ftz'
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
lang_to_code = {
|
17 |
'Эрзянь | Erzya': 'myv_XX',
|
@@ -136,6 +143,19 @@ def translate_wrapper(text, src, trg):
|
|
136 |
return result
|
137 |
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
interface = gr.Interface(
|
140 |
translate_wrapper,
|
141 |
[
|
@@ -144,6 +164,11 @@ interface = gr.Interface(
|
|
144 |
gr.Dropdown(list(lang_to_code.keys()), type="value", label='target language / эряви келесь', value=list(lang_to_code.keys())[1]),
|
145 |
],
|
146 |
"text",
|
|
|
|
|
|
|
|
|
|
|
147 |
)
|
148 |
|
149 |
|
|
|
12 |
MODEL_URL_LANGID = 'https://huggingface.co/slone/fastText-LID-323/resolve/main/lid.323.ftz'
|
13 |
MODEL_PATH_LANGID = 'lid.323.ftz'
|
14 |
|
15 |
+
HF_TOKEN = os.getenv('HF_TOKEN')
|
16 |
+
hf_writer = gr.HuggingFaceDatasetSaver(
|
17 |
+
HF_TOKEN,
|
18 |
+
dataset_name="myv-translation-2022-demo-flags",
|
19 |
+
private=True,
|
20 |
+
)
|
21 |
+
|
22 |
|
23 |
lang_to_code = {
|
24 |
'Эрзянь | Erzya': 'myv_XX',
|
|
|
143 |
return result
|
144 |
|
145 |
|
146 |
+
article = """
|
147 |
+
Те васенце автоматической ютавтыця ютавтыця эрзянь кельсэ. Тонакстнэ улить статьясо (курок сы).
|
148 |
+
|
149 |
+
Это первый автоматический переводчик для эрзянского языка. Подробности – в статье (скоро выйдет).
|
150 |
+
Пожалуйста, оставляйте своё мнение о качестве переводов с помощью кнопок с эмодзи!
|
151 |
+
|
152 |
+
This is the first automatic translator for the Erzya language. The details are in the paper (will be published soon).
|
153 |
+
Please leave your feedback about the quality of translations using the buttons with emojis.
|
154 |
+
|
155 |
+
The code and models for translation can be found in the repository: https://github.com/slone-nlp/myv-nmt.
|
156 |
+
"""
|
157 |
+
|
158 |
+
|
159 |
interface = gr.Interface(
|
160 |
translate_wrapper,
|
161 |
[
|
|
|
164 |
gr.Dropdown(list(lang_to_code.keys()), type="value", label='target language / эряви келесь', value=list(lang_to_code.keys())[1]),
|
165 |
],
|
166 |
"text",
|
167 |
+
allow_flagging="manual",
|
168 |
+
flagging_options=["good 🙂", "50/50 😐", "bad 🙁"],
|
169 |
+
flagging_callback=hf_writer,
|
170 |
+
title='Эрзянь ютавтыця | Эрзянский переводчик | Erzya translator',
|
171 |
+
article=article,
|
172 |
)
|
173 |
|
174 |
|