Spaces:
Sleeping
Sleeping
ffreemt
commited on
Commit
·
789a2ce
1
Parent(s):
ab0881d
Update ycecream loguru, add tz
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ from src.translation_agent.utils import one_chunk_improve_translation
|
|
| 19 |
from src.translation_agent.utils import one_chunk_initial_translation
|
| 20 |
from src.translation_agent.utils import one_chunk_reflect_on_translation
|
| 21 |
|
|
|
|
| 22 |
y.configure(sln=1, show_time=1)
|
| 23 |
|
| 24 |
os.environ["TZ"] = "Asia/Shanghai"
|
|
@@ -93,9 +94,7 @@ def translate_text(
|
|
| 93 |
translation_2 = one_chunk_improve_translation(
|
| 94 |
source_lang, target_lang, source_text, translation_1, reflection
|
| 95 |
)
|
| 96 |
-
translation_diff = diff_texts(
|
| 97 |
-
translation_1, translation_2, target_lang
|
| 98 |
-
)
|
| 99 |
yield translation_1, reflection, translation_diff
|
| 100 |
|
| 101 |
else:
|
|
@@ -142,9 +141,7 @@ def translate_text(
|
|
| 142 |
)
|
| 143 |
y(translation_2_chunks)
|
| 144 |
translation_2 = "".join(translation_2_chunks)
|
| 145 |
-
translation_diff = diff_texts(
|
| 146 |
-
translation_1, translation_2, target_lang
|
| 147 |
-
)
|
| 148 |
|
| 149 |
yield translation_1, reflection, translation_diff
|
| 150 |
|
|
@@ -171,9 +168,7 @@ with gr.Blocks() as demo:
|
|
| 171 |
label="Target Language",
|
| 172 |
)
|
| 173 |
country = gr.Textbox(label="Country (for target language)")
|
| 174 |
-
source_text = gr.Textbox(
|
| 175 |
-
label="Source Text", lines=5, show_copy_button=True
|
| 176 |
-
)
|
| 177 |
|
| 178 |
btn = gr.Button("Translate")
|
| 179 |
|
|
|
|
| 19 |
from src.translation_agent.utils import one_chunk_initial_translation
|
| 20 |
from src.translation_agent.utils import one_chunk_reflect_on_translation
|
| 21 |
|
| 22 |
+
|
| 23 |
y.configure(sln=1, show_time=1)
|
| 24 |
|
| 25 |
os.environ["TZ"] = "Asia/Shanghai"
|
|
|
|
| 94 |
translation_2 = one_chunk_improve_translation(
|
| 95 |
source_lang, target_lang, source_text, translation_1, reflection
|
| 96 |
)
|
| 97 |
+
translation_diff = diff_texts(translation_1, translation_2, target_lang)
|
|
|
|
|
|
|
| 98 |
yield translation_1, reflection, translation_diff
|
| 99 |
|
| 100 |
else:
|
|
|
|
| 141 |
)
|
| 142 |
y(translation_2_chunks)
|
| 143 |
translation_2 = "".join(translation_2_chunks)
|
| 144 |
+
translation_diff = diff_texts(translation_1, translation_2, target_lang)
|
|
|
|
|
|
|
| 145 |
|
| 146 |
yield translation_1, reflection, translation_diff
|
| 147 |
|
|
|
|
| 168 |
label="Target Language",
|
| 169 |
)
|
| 170 |
country = gr.Textbox(label="Country (for target language)")
|
| 171 |
+
source_text = gr.Textbox(label="Source Text", lines=5, show_copy_button=True)
|
|
|
|
|
|
|
| 172 |
|
| 173 |
btn = gr.Button("Translate")
|
| 174 |
|