Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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(
|
15 |
# 將當前訊息與歷史訊息合併
|
16 |
#input_text = message if not history else history[-1]["content"] + " " + message
|
17 |
#input_text = message+",(450字內回覆)"
|
18 |
-
|
|
|
19 |
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
|
20 |
-
{"role": "user", "content":
|
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,
|