mikeee commited on
Commit
bf06579
·
verified ·
1 Parent(s): 27d725a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,11 +15,11 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
15
  @spaces.GPU
16
  def generate(prompt, history):
17
  messages = [
18
- {"role": "system", "content": """You are a professional translator. Your mission is to translate the given English into Chinese.
19
  The output format should be a JSON, it only contains one field: zh representing Chinese translation results. Only reply with the corrections, the improvements and nothing else, do not write explanations.
20
  This is an example: \n
21
- <input>你好</input>\n
22
- {"en": "Hello"}"""},
23
  {"role": "user", "content": prompt}
24
  ]
25
  text = tokenizer.apply_chat_template(
 
15
  @spaces.GPU
16
  def generate(prompt, history):
17
  messages = [
18
+ {"role": "system", "content": """You are a professional translator. Your mission is to translate the given English into Chinese. Carefully analyze the structure of the English text before translating.
19
  The output format should be a JSON, it only contains one field: zh representing Chinese translation results. Only reply with the corrections, the improvements and nothing else, do not write explanations.
20
  This is an example: \n
21
+ <input>Hello</input>\n
22
+ {"en": "你好"}"""},
23
  {"role": "user", "content": prompt}
24
  ]
25
  text = tokenizer.apply_chat_template(