Spaces:
Sleeping
Sleeping
add chunk size function
Browse files
app.py
CHANGED
@@ -182,10 +182,12 @@ def summary_translate(src_text, temp_tgt_text, tgt_language, session_id):
|
|
182 |
translation = generate_translation(prompt_style, prompt)
|
183 |
translations.append(translation)
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
189 |
|
190 |
def plan2align_translate_text(text, session_id, model, tokenizer, device, src_language, task_language, max_iterations_value, threshold_value, good_ref_contexts_num_value, reward_model_type):
|
191 |
result = translate_text(
|
|
|
182 |
translation = generate_translation(prompt_style, prompt)
|
183 |
translations.append(translation)
|
184 |
|
185 |
+
try:
|
186 |
+
_, score = evaluate_candidates(src_text, translations, tgt_language, session_id)
|
187 |
+
except:
|
188 |
+
score = 0
|
189 |
+
|
190 |
+
return translations[0], score
|
191 |
|
192 |
def plan2align_translate_text(text, session_id, model, tokenizer, device, src_language, task_language, max_iterations_value, threshold_value, good_ref_contexts_num_value, reward_model_type):
|
193 |
result = translate_text(
|