Update app.py
Browse files
app.py
CHANGED
@@ -186,12 +186,12 @@ def bin2coord(bins, w_resize_ratio, h_resize_ratio, cfg):
|
|
186 |
|
187 |
def encode_text(text, length=None, append_bos=False, append_eos=False):
|
188 |
line = [
|
189 |
-
|
190 |
if not word.startswith('<code_') and not word.startswith('<bin_') else word
|
191 |
for word in text.strip().split()
|
192 |
]
|
193 |
line = ' '.join(line)
|
194 |
-
s =
|
195 |
line=line,
|
196 |
add_if_not_exist=False,
|
197 |
append_eos=False
|
|
|
186 |
|
187 |
def encode_text(text, length=None, append_bos=False, append_eos=False):
|
188 |
line = [
|
189 |
+
general_task.bpe.encode(' {}'.format(word.strip()))
|
190 |
if not word.startswith('<code_') and not word.startswith('<bin_') else word
|
191 |
for word in text.strip().split()
|
192 |
]
|
193 |
line = ' '.join(line)
|
194 |
+
s = general_task.tgt_dict.encode_line(
|
195 |
line=line,
|
196 |
add_if_not_exist=False,
|
197 |
append_eos=False
|