Update app/webui/app.py
Browse files- app/webui/app.py +9 -1
app/webui/app.py
CHANGED
@@ -27,6 +27,7 @@ def huanik(
|
|
27 |
context_window: int,
|
28 |
num_output: int,
|
29 |
rpm: int,
|
|
|
30 |
):
|
31 |
|
32 |
if not source_text or source_lang == target_lang:
|
@@ -39,7 +40,7 @@ def huanik(
|
|
39 |
|
40 |
source_text = re.sub(r'(?m)^\s*$\n?', '', source_text)
|
41 |
|
42 |
-
if choice:
|
43 |
init_translation, reflect_translation, final_translation = translator_sec(
|
44 |
endpoint2=endpoint2,
|
45 |
model2=model2,
|
@@ -51,6 +52,7 @@ def huanik(
|
|
51 |
source_text=source_text,
|
52 |
country=country,
|
53 |
max_tokens=max_tokens,
|
|
|
54 |
)
|
55 |
|
56 |
else:
|
@@ -120,6 +122,12 @@ def closeBtnHide(output_final):
|
|
120 |
if output_final:
|
121 |
return gr.update(visible=True), gr.update(visible=False)
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
TITLE = """
|
124 |
<div style="display: inline-flex;">
|
125 |
<div style="margin-left: 6px; font-size:32px; color: #6366f1"><b>Translation Agent</b> WebUI</div>
|
|
|
27 |
context_window: int,
|
28 |
num_output: int,
|
29 |
rpm: int,
|
30 |
+
gt: bool,
|
31 |
):
|
32 |
|
33 |
if not source_text or source_lang == target_lang:
|
|
|
40 |
|
41 |
source_text = re.sub(r'(?m)^\s*$\n?', '', source_text)
|
42 |
|
43 |
+
if choice or gt:
|
44 |
init_translation, reflect_translation, final_translation = translator_sec(
|
45 |
endpoint2=endpoint2,
|
46 |
model2=model2,
|
|
|
52 |
source_text=source_text,
|
53 |
country=country,
|
54 |
max_tokens=max_tokens,
|
55 |
+
gt = gt,
|
56 |
)
|
57 |
|
58 |
else:
|
|
|
122 |
if output_final:
|
123 |
return gr.update(visible=True), gr.update(visible=False)
|
124 |
|
125 |
+
def hide_add(gt):
|
126 |
+
if gt:
|
127 |
+
return gr.update(visible=False), gr.update(visible=False)
|
128 |
+
else:
|
129 |
+
return gr.update(value=False, visible=True), gr.update(visible=False)
|
130 |
+
|
131 |
TITLE = """
|
132 |
<div style="display: inline-flex;">
|
133 |
<div style="margin-left: 6px; font-size:32px; color: #6366f1"><b>Translation Agent</b> WebUI</div>
|