hsuwill000 commited on
Commit
656dfd6
·
verified ·
1 Parent(s): 7c17167

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -11,13 +11,14 @@ tokenizer = AutoTokenizer.from_pretrained(model_id)
11
  # 建立生成管道
12
  #pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
13
 
14
- def respond(messages, history):
15
  # 將當前訊息與歷史訊息合併
16
  #input_text = message if not history else history[-1]["content"] + " " + message
17
  #input_text = message+",(450字內回覆)"
18
- input_text = [
 
19
  {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
20
- {"role": "user", "content": messages}
21
  ]
22
  text = tokenizer.apply_chat_template(
23
  messages,
 
11
  # 建立生成管道
12
  #pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
13
 
14
+ def respond(prompt , history):
15
  # 將當前訊息與歷史訊息合併
16
  #input_text = message if not history else history[-1]["content"] + " " + message
17
  #input_text = message+",(450字內回覆)"
18
+
19
+ messages = [
20
  {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
21
+ {"role": "user", "content": prompt }
22
  ]
23
  text = tokenizer.apply_chat_template(
24
  messages,