kevinpro commited on
Commit
6cbc38e
·
verified ·
1 Parent(s): 113c3ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -16
app.py CHANGED
@@ -22,7 +22,7 @@ def _translate(text: str, src_lang: str, tgt_lang: str):
22
  prompt = f"Translate the following text from {src_lang} to {tgt_lang}: {text}"
23
  openai_client = openai.OpenAI(base_url="https://ssapi.cppbear.site/v1", api_key="sk-5VFSx79t3fLQk4BtN68WTeeRckZ12CONElR7RsK39zrQysji")
24
  response = openai_client.chat.completions.create(
25
- model="v0-1.5-md", # 如gpt-3.5-turbo或其他兼容模型
26
  messages=[{"role": "user", "content": prompt}],
27
  max_tokens=1024,
28
  temperature=0.0
@@ -32,26 +32,16 @@ def _translate(text: str, src_lang: str, tgt_lang: str):
32
 
33
  description = """
34
  <div style="text-align: center;">
35
- <img src="https://huggingface.co/spaces/UNESCO/nllb/resolve/main/UNESCO_META_HF_BANNER.png" alt="UNESCO Meta Hugging Face Banner" style="max-width: 800px; width: 100%; margin: 0 auto;">
36
- <h1 style="color: #0077be;">UNESCO Language Translator, powered by Meta and Hugging Face</h1>
37
  </div>
38
- UNESCO, Meta, and Hugging Face have come together to create an accessible, high-quality translation experience in 200 languages.
39
- This is made possible through an open approach to AI innovation using Meta's open-sourced No Language Left Behind (NLLB) AI model, hosted on Hugging Face Spaces.
40
  """
41
  disclaimer = """
42
- ## Disclaimer
43
- This translation interface, developed as part of UNESCO's work on Multilingualism and supported by Meta's No Language Left Behind AI model and Hugging Face, is designed to assist with language translation using open-source AI technologies. However, translations generated by the tool may not be accurate or perfect. While we strive to provide accurate translations, the tool may produce inaccuracies due to the complexity and nuances of different languages.
44
- - The tool may not fully capture the context, cultural nuances, idiomatic expressions, or specific terminologies.
45
- - Manual review and adjustment are recommended for important translations.
46
- - The translations are provided "as is" without any warranties of any kind, either expressed or implied.
47
- - Users should not rely solely on the tool for critical or sensitive translations and are responsible for verifying the accuracy and appropriateness of the translations for their specific needs.
48
- - We recommend consulting with professional translators for official, legal, medical, or other critical translations.
49
- - We shall not be liable for any direct, indirect, incidental, special, or consequential damages arising out of or in connection with the use or inability to use the translation tool, including but not limited to errors or omissions in translations.
50
- By using this translation tool, you agree to these terms and acknowledge that the use of the tool is at your own risk.
51
- For any feedback or support, please contact UNESCO World Atlas of Languages Team: [email protected].
52
  """
53
 
54
- examples_inputs = [["The United Nations Educational, Scientific and Cultural Organization is a specialized agency of the United Nations with the aim of promoting world peace and security through international cooperation in education, arts, sciences and culture. ","English","Ayacucho Quechua"],]
55
 
56
  with gr.Blocks() as demo:
57
  gr.Markdown(description)
 
22
  prompt = f"Translate the following text from {src_lang} to {tgt_lang}: {text}"
23
  openai_client = openai.OpenAI(base_url="https://ssapi.cppbear.site/v1", api_key="sk-5VFSx79t3fLQk4BtN68WTeeRckZ12CONElR7RsK39zrQysji")
24
  response = openai_client.chat.completions.create(
25
+ model="gemini-2.5-flash", # 如gpt-3.5-turbo或其他兼容模型
26
  messages=[{"role": "user", "content": prompt}],
27
  max_tokens=1024,
28
  temperature=0.0
 
32
 
33
  description = """
34
  <div style="text-align: center;">
35
+ <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;">
36
+ <h1 style="color: #0077be;">Seed-X, powered by Bytedance</h1>
37
  </div>
38
+ 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:
 
39
  """
40
  disclaimer = """
41
+ 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
 
 
 
 
 
 
 
 
 
42
  """
43
 
44
+ examples_inputs = [["Seed-X is indeed a good translation model ","English","Chinese"],]
45
 
46
  with gr.Blocks() as demo:
47
  gr.Markdown(description)