Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,56 +84,47 @@ def translate_text(text, source_lang, target_lang):
|
|
| 84 |
|
| 85 |
|
| 86 |
description = """
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
<h1 style="color: #0077be;">Seed-X: Building Strong Multilingual Translation LLM with 7B Parameters</h1>
|
| 90 |
-
</div>
|
| 91 |
-
"""
|
| 92 |
-
|
| 93 |
-
description = """
|
| 94 |
-
<div style="text-align: center;">
|
| 95 |
-
<img src="https://github.com/user-attachments/assets/c42e675e-497c-4508-8bb9-093ad4d1f216" alt="UNESCO Meta Hugging Face Banner" style="max-width: 800px; width: 100%; margin: 0 auto;">
|
| 96 |
-
<h1 style="color: #0077be; font-size: 3em;">Seed-X, powered by Bytedance</h1>
|
| 97 |
-
</div>
|
| 98 |
-
We are excited to introduce Seed-X, a powerful series of open-source multilingual translation language models, including an instruction model, a reinforcement learning model, and a reward model. It pushes the boundaries of translation capabilities within 7 billion parameters. We develop Seed-X as an accessible, off-the-shelf tool to support the community in advancing translation research and applications:
|
| 99 |
"""
|
| 100 |
|
| 101 |
# 创建 Gradio 界面
|
| 102 |
with gr.Blocks(title="Seed-X") as demo:
|
| 103 |
gr.Markdown(description)
|
| 104 |
-
|
| 105 |
-
with gr.
|
| 106 |
-
with gr.
|
| 107 |
source_lang = gr.Dropdown(
|
| 108 |
choices=list(LANGUAGES.keys()),
|
| 109 |
value="Auto Detect",
|
| 110 |
label="Source Language"
|
| 111 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
source_text = gr.Textbox(
|
| 113 |
label="Input Text",
|
| 114 |
placeholder="Please enter the text to translate...",
|
| 115 |
lines=5
|
| 116 |
)
|
| 117 |
-
with gr.Column():
|
| 118 |
target_text = gr.Textbox(
|
| 119 |
label="Translation Result",
|
| 120 |
interactive=False,
|
| 121 |
lines=5
|
| 122 |
)
|
| 123 |
-
target_lang = gr.Dropdown(
|
| 124 |
-
choices=list(LANGUAGES.keys())[1:], # Exclude "Auto Detect"
|
| 125 |
-
value="English",
|
| 126 |
-
label="Target Language"
|
| 127 |
-
)
|
| 128 |
-
translate_btn = gr.Button("Translate", variant="primary")
|
| 129 |
|
| 130 |
|
| 131 |
# # 示例
|
| 132 |
gr.Examples(
|
| 133 |
examples=[
|
| 134 |
["我说一句你说一车啊", "Chinese", "English"],
|
| 135 |
-
["
|
| 136 |
["Their relationship is a total situationship.", "English", "Chinese"],
|
|
|
|
| 137 |
],
|
| 138 |
inputs=[source_text, source_lang, target_lang],
|
| 139 |
outputs=target_text,
|
|
|
|
| 84 |
|
| 85 |
|
| 86 |
description = """
|
| 87 |
+
#👋 Seed-X, powered by Bytedance
|
| 88 |
+
We are excited to introduce Seed-X, a powerful series of open-source multilingual translation language models, including an instruction model, a reinforcement learning model, and a reward model. It pushes the boundaries of translation capabilities within 7 billion parameters. We develop Seed-X as an accessible, off-the-shelf tool to support the community in advancing translation research and applications.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
"""
|
| 90 |
|
| 91 |
# 创建 Gradio 界面
|
| 92 |
with gr.Blocks(title="Seed-X") as demo:
|
| 93 |
gr.Markdown(description)
|
| 94 |
+
|
| 95 |
+
with gr.Column():
|
| 96 |
+
with gr.Row():
|
| 97 |
source_lang = gr.Dropdown(
|
| 98 |
choices=list(LANGUAGES.keys()),
|
| 99 |
value="Auto Detect",
|
| 100 |
label="Source Language"
|
| 101 |
)
|
| 102 |
+
target_lang = gr.Dropdown(
|
| 103 |
+
choices=list(LANGUAGES.keys())[1:], # Exclude "Auto Detect"
|
| 104 |
+
value="English",
|
| 105 |
+
label="Target Language"
|
| 106 |
+
)
|
| 107 |
+
translate_btn = gr.Button("Translate", variant="primary")
|
| 108 |
+
with gr.Row():
|
| 109 |
source_text = gr.Textbox(
|
| 110 |
label="Input Text",
|
| 111 |
placeholder="Please enter the text to translate...",
|
| 112 |
lines=5
|
| 113 |
)
|
|
|
|
| 114 |
target_text = gr.Textbox(
|
| 115 |
label="Translation Result",
|
| 116 |
interactive=False,
|
| 117 |
lines=5
|
| 118 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
# # 示例
|
| 122 |
gr.Examples(
|
| 123 |
examples=[
|
| 124 |
["我说一句你说一车啊", "Chinese", "English"],
|
| 125 |
+
["离谱她妈给离谱开门,离谱到家了", "Chinese", "English"],
|
| 126 |
["Their relationship is a total situationship.", "English", "Chinese"],
|
| 127 |
+
["雨女无瓜","Chinese", "Chinese"],
|
| 128 |
],
|
| 129 |
inputs=[source_text, source_lang, target_lang],
|
| 130 |
outputs=target_text,
|