Spaces:
Sleeping
Sleeping
KuangDW
commited on
Commit
·
0fbaf56
1
Parent(s):
6d30719
fix session state and translation input
Browse files
app.py
CHANGED
@@ -210,8 +210,9 @@ def mpc_translation(text, src_language, target_language, iterations, session_id)
|
|
210 |
# ---------- Gradio function ----------
|
211 |
|
212 |
def process_text(text, src_language, target_language, max_iterations_value, threshold_value,
|
213 |
-
good_ref_contexts_num_value, translation_methods, state):
|
214 |
|
|
|
215 |
state = state or {}
|
216 |
session_id = get_user_session(state)
|
217 |
|
@@ -336,8 +337,7 @@ with gr.Blocks(title="Test-Time Machine Translation with Plan2Align") as demo:
|
|
336 |
task_language_input,
|
337 |
max_iterations_input,
|
338 |
threshold_input,
|
339 |
-
good_ref_contexts_num_input
|
340 |
-
state
|
341 |
],
|
342 |
outputs=[original_output, plan2align_output, best_of_n_output, mpc_output],
|
343 |
fn=process_text
|
|
|
210 |
# ---------- Gradio function ----------
|
211 |
|
212 |
def process_text(text, src_language, target_language, max_iterations_value, threshold_value,
|
213 |
+
good_ref_contexts_num_value, translation_methods=None, state=None):
|
214 |
|
215 |
+
translation_methods = translation_methods or ["Original", "Plan2Align"]
|
216 |
state = state or {}
|
217 |
session_id = get_user_session(state)
|
218 |
|
|
|
337 |
task_language_input,
|
338 |
max_iterations_input,
|
339 |
threshold_input,
|
340 |
+
good_ref_contexts_num_input
|
|
|
341 |
],
|
342 |
outputs=[original_output, plan2align_output, best_of_n_output, mpc_output],
|
343 |
fn=process_text
|