Update app.py
Browse files
app.py
CHANGED
@@ -23,11 +23,14 @@ def user(message, history):
|
|
23 |
|
24 |
def chat(history):
|
25 |
chat = []
|
|
|
26 |
for item in history:
|
27 |
chat.append({"role": "user", "content": item[0]})
|
28 |
if item[1] is not None:
|
29 |
-
chat.append({"role": "assistant", "content": item[
|
|
|
30 |
messages = tokenizer.apply_chat_template(chat, tokenize=False)
|
|
|
31 |
# Tokenize the messages string
|
32 |
model_inputs = tok([messages], return_tensors="pt")
|
33 |
streamer = TextIteratorStreamer(
|
|
|
23 |
|
24 |
def chat(history):
|
25 |
chat = []
|
26 |
+
print(history)
|
27 |
for item in history:
|
28 |
chat.append({"role": "user", "content": item[0]})
|
29 |
if item[1] is not None:
|
30 |
+
chat.append({"role": "assistant", "content": item[1]})
|
31 |
+
print(chat)
|
32 |
messages = tokenizer.apply_chat_template(chat, tokenize=False)
|
33 |
+
print(messages)
|
34 |
# Tokenize the messages string
|
35 |
model_inputs = tok([messages], return_tensors="pt")
|
36 |
streamer = TextIteratorStreamer(
|