Update app.py
Browse files
app.py
CHANGED
@@ -18,14 +18,12 @@ good_examples = [
|
|
18 |
]
|
19 |
|
20 |
bad_examples = [
|
21 |
-
["The weather is beautiful today.", "วันนี้อากาศแย่สุดๆ"],
|
22 |
-
["I need to go to the hospital.", "ฉันอยากกินข้าว"],
|
23 |
-
["This restaurant serves delicious food.", "ร้านนี้ไม่อร่อยเลย"],
|
24 |
-
["Can you help me find the nearest train station?", "คุณพูดภาษาอังกฤษได้ไหม?"]
|
25 |
]
|
26 |
|
27 |
-
examples = good_examples + bad_examples
|
28 |
-
|
29 |
font_css = """
|
30 |
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap");
|
31 |
|
@@ -37,19 +35,32 @@ font_css = """
|
|
37 |
with gr.Blocks(theme=gr.themes.Soft(), css=font_css) as demo:
|
38 |
gr.Markdown("# ComeTH Translation Quality Estimator")
|
39 |
with gr.Row():
|
40 |
-
with gr.Column():
|
41 |
src_input = gr.Textbox(label="Source Text (English)", placeholder="Enter English text here...")
|
42 |
mt_input = gr.Textbox(label="Candidate Translation (Thai)", placeholder="Enter Thai translation here...")
|
43 |
score_button = gr.Button("Evaluate Translation", variant="primary")
|
44 |
-
with gr.Column():
|
45 |
score_output = gr.Label(label="Quality Scores")
|
46 |
gr.Markdown("### Higher scores indicate better translation quality across multiple dimensions")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
gr.Examples(
|
48 |
-
examples=
|
49 |
inputs=[src_input, mt_input],
|
50 |
outputs=score_output,
|
51 |
-
fn=score_translation
|
|
|
52 |
)
|
|
|
53 |
score_button.click(fn=score_translation, inputs=[src_input, mt_input], outputs=score_output)
|
54 |
|
55 |
if __name__ == "__main__":
|
|
|
18 |
]
|
19 |
|
20 |
bad_examples = [
|
21 |
+
["The weather is beautiful today.", "วันนี้อากาศแย่สุดๆ"],
|
22 |
+
["I need to go to the hospital.", "ฉันอยากกินข้าว"],
|
23 |
+
["This restaurant serves delicious food.", "ร้านนี้ไม่อร่อยเลย"],
|
24 |
+
["Can you help me find the nearest train station?", "คุณพูดภาษาอังกฤษได้ไหม?"]
|
25 |
]
|
26 |
|
|
|
|
|
27 |
font_css = """
|
28 |
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap");
|
29 |
|
|
|
35 |
with gr.Blocks(theme=gr.themes.Soft(), css=font_css) as demo:
|
36 |
gr.Markdown("# ComeTH Translation Quality Estimator")
|
37 |
with gr.Row():
|
38 |
+
with gr.Column(scale=1):
|
39 |
src_input = gr.Textbox(label="Source Text (English)", placeholder="Enter English text here...")
|
40 |
mt_input = gr.Textbox(label="Candidate Translation (Thai)", placeholder="Enter Thai translation here...")
|
41 |
score_button = gr.Button("Evaluate Translation", variant="primary")
|
42 |
+
with gr.Column(scale=1):
|
43 |
score_output = gr.Label(label="Quality Scores")
|
44 |
gr.Markdown("### Higher scores indicate better translation quality across multiple dimensions")
|
45 |
+
|
46 |
+
gr.Markdown("## Good Translation Examples")
|
47 |
+
gr.Examples(
|
48 |
+
examples=good_examples,
|
49 |
+
inputs=[src_input, mt_input],
|
50 |
+
outputs=score_output,
|
51 |
+
fn=score_translation,
|
52 |
+
layout="vertical"
|
53 |
+
)
|
54 |
+
|
55 |
+
gr.Markdown("## Bad Translation Examples")
|
56 |
gr.Examples(
|
57 |
+
examples=bad_examples,
|
58 |
inputs=[src_input, mt_input],
|
59 |
outputs=score_output,
|
60 |
+
fn=score_translation,
|
61 |
+
layout="vertical"
|
62 |
)
|
63 |
+
|
64 |
score_button.click(fn=score_translation, inputs=[src_input, mt_input], outputs=score_output)
|
65 |
|
66 |
if __name__ == "__main__":
|