Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -20,11 +20,11 @@ def translate(text: str, src_lang: str, tgt_lang: str):
|
|
20 |
return _translate(text, src_lang, tgt_lang)
|
21 |
|
22 |
def _translate(text: str, src_lang: str, tgt_lang: str):
|
23 |
-
prompt = f"Translate the following text from {src_lang} to {tgt_lang}
|
24 |
key=os.getenv('key')
|
25 |
openai_client = openai.OpenAI(base_url="https://ssapi.cppbear.site/v1", api_key=key)
|
26 |
response = openai_client.chat.completions.create(
|
27 |
-
model="
|
28 |
messages=[{"role": "user", "content": prompt}],
|
29 |
max_tokens=30240,
|
30 |
temperature=0.0
|
@@ -39,9 +39,6 @@ description = """
|
|
39 |
</div>
|
40 |
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:
|
41 |
"""
|
42 |
-
disclaimer = """
|
43 |
-
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
|
44 |
-
"""
|
45 |
|
46 |
examples_inputs = [["Seed-X is indeed a good translation model ","English","Chinese"],]
|
47 |
|
@@ -62,6 +59,4 @@ with gr.Blocks() as demo:
|
|
62 |
outputs=output,
|
63 |
)
|
64 |
examples = gr.Examples(examples=examples_inputs,inputs=[input_text, src_lang,target_lang], fn=translate, outputs=output, cache_examples=True)
|
65 |
-
with gr.Row():
|
66 |
-
gr.Markdown(disclaimer)
|
67 |
demo.launch()
|
|
|
20 |
return _translate(text, src_lang, tgt_lang)
|
21 |
|
22 |
def _translate(text: str, src_lang: str, tgt_lang: str):
|
23 |
+
prompt = f"Translate the following text from {src_lang} to {tgt_lang}. Direct output translation result without any explaination:\n\n{text}"
|
24 |
key=os.getenv('key')
|
25 |
openai_client = openai.OpenAI(base_url="https://ssapi.cppbear.site/v1", api_key=key)
|
26 |
response = openai_client.chat.completions.create(
|
27 |
+
model="tbai.xin-dpsk-deepseek-v3", # 如gpt-3.5-turbo或其他兼容模型
|
28 |
messages=[{"role": "user", "content": prompt}],
|
29 |
max_tokens=30240,
|
30 |
temperature=0.0
|
|
|
39 |
</div>
|
40 |
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:
|
41 |
"""
|
|
|
|
|
|
|
42 |
|
43 |
examples_inputs = [["Seed-X is indeed a good translation model ","English","Chinese"],]
|
44 |
|
|
|
59 |
outputs=output,
|
60 |
)
|
61 |
examples = gr.Examples(examples=examples_inputs,inputs=[input_text, src_lang,target_lang], fn=translate, outputs=output, cache_examples=True)
|
|
|
|
|
62 |
demo.launch()
|