Update app.py
Browse files
app.py
CHANGED
@@ -77,20 +77,18 @@ def translate_text(text, source_lang, target_lang):
|
|
77 |
num_return_sequences=1,
|
78 |
)
|
79 |
full_output = tokenizer.decode(translated_chunk[0], skip_special_tokens=True)
|
80 |
-
full_output = full_output.replace(
|
81 |
yield full_output
|
82 |
except Exception as e:
|
83 |
yield f"翻译出错: {str(e)}"
|
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(
|
|
|
|
|
|
|
94 |
|
95 |
with gr.Column():
|
96 |
with gr.Row():
|
@@ -104,6 +102,7 @@ with gr.Blocks(title="Seed-X") as demo:
|
|
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(
|
|
|
77 |
num_return_sequences=1,
|
78 |
)
|
79 |
full_output = tokenizer.decode(translated_chunk[0], skip_special_tokens=True)
|
80 |
+
full_output = full_output.replace(text.strip(),"")
|
81 |
yield full_output
|
82 |
except Exception as e:
|
83 |
yield f"翻译出错: {str(e)}"
|
84 |
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
# 创建 Gradio 界面
|
87 |
with gr.Blocks(title="Seed-X") as demo:
|
88 |
+
gr.Markdown("# 👋 Seed-X, powered by Bytedance")
|
89 |
+
gr.Markdown(
|
90 |
+
'A real-time translation tool based on Seed-X. It pushes the boundaries of translation capabilities within 7 billion parameters.'
|
91 |
+
)
|
92 |
|
93 |
with gr.Column():
|
94 |
with gr.Row():
|
|
|
102 |
value="English",
|
103 |
label="Target Language"
|
104 |
)
|
105 |
+
with gr.Row():
|
106 |
translate_btn = gr.Button("Translate", variant="primary")
|
107 |
with gr.Row():
|
108 |
source_text = gr.Textbox(
|