cointegrated commited on
Commit
967e32f
1 Parent(s): 9c3fd77

revert the new column in the dataset

Browse files
Files changed (1) hide show
  1. app.py +2 -36
app.py CHANGED
@@ -14,42 +14,8 @@ MODEL_URL_LANGID = 'https://huggingface.co/slone/fastText-LID-323/resolve/main/l
14
  MODEL_PATH_LANGID = 'lid.323.ftz'
15
 
16
 
17
- class DSaverFixed(gr.HuggingFaceDatasetSaver):
18
- def __init__(
19
- self,
20
- hf_token: str,
21
- dataset_name: str,
22
- organization=None,
23
- private=False,
24
- ):
25
- self.hf_token = hf_token
26
- self.dataset_name = dataset_name
27
- self.organization_name = organization
28
- self.dataset_private = private
29
-
30
- def setup(self, components, flagging_dir):
31
- path_to_dataset_repo = huggingface_hub.create_repo(
32
- repo_id=self.dataset_name,
33
- token=self.hf_token,
34
- private=self.dataset_private,
35
- repo_type="dataset",
36
- exist_ok=True,
37
- )
38
- self.path_to_dataset_repo = path_to_dataset_repo
39
- self.components = components
40
- self.flagging_dir = flagging_dir
41
- self.dataset_dir = os.path.join(flagging_dir, self.dataset_name)
42
- self.repo = huggingface_hub.Repository(
43
- local_dir=self.dataset_dir,
44
- clone_from=path_to_dataset_repo,
45
- use_auth_token=self.hf_token,
46
- )
47
- self.repo.git_pull(lfs=True)
48
- self.infos_file = os.path.join(self.dataset_dir, "dataset_infos.json")
49
-
50
-
51
  HF_TOKEN = os.getenv('HF_TOKEN')
52
- hf_writer = DSaverFixed(
53
  hf_token=HF_TOKEN,
54
  dataset_name="myv-translation-2022-demo-flags",
55
  organization="slone",
@@ -199,7 +165,7 @@ interface = gr.Interface(
199
  gr.Textbox(label="Text / текст", lines=2, placeholder='text to translate / текст ютавтозь'),
200
  gr.Dropdown(list(lang_to_code.keys()), type="value", label='source language / васенце кель', value=list(lang_to_code.keys())[0]),
201
  gr.Dropdown(list(lang_to_code.keys()), type="value", label='target language / эрявикс кель', value=list(lang_to_code.keys())[1]),
202
- gr.Textbox(label="Correct translation", lines=2, placeholder='Type here a correct translation, in case if you want to report it.'),
203
  ],
204
  "text",
205
  allow_flagging="manual",
 
14
  MODEL_PATH_LANGID = 'lid.323.ftz'
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  HF_TOKEN = os.getenv('HF_TOKEN')
18
+ hf_writer = gr.HuggingFaceDatasetSaver(
19
  hf_token=HF_TOKEN,
20
  dataset_name="myv-translation-2022-demo-flags",
21
  organization="slone",
 
165
  gr.Textbox(label="Text / текст", lines=2, placeholder='text to translate / текст ютавтозь'),
166
  gr.Dropdown(list(lang_to_code.keys()), type="value", label='source language / васенце кель', value=list(lang_to_code.keys())[0]),
167
  gr.Dropdown(list(lang_to_code.keys()), type="value", label='target language / эрявикс кель', value=list(lang_to_code.keys())[1]),
168
+ # gr.Textbox(label="Correct translation", lines=2, placeholder='Type here a correct translation, in case if you want to submit it instead of a wrong one.'),
169
  ],
170
  "text",
171
  allow_flagging="manual",