chore: simplify
Browse files
app.py
CHANGED
|
@@ -65,12 +65,11 @@ examples = [
|
|
| 65 |
def predict(message, history):
|
| 66 |
history.append({"role": "system", "content": system_prompt})
|
| 67 |
history.append({"role": "user", "content": message})
|
| 68 |
-
|
| 69 |
-
inputs = tokenizer.
|
| 70 |
-
outputs = model.generate(inputs, max_new_tokens=100
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
# response: I'm ready to help you with your math homework. What's your math problem?
|
| 74 |
print(f"Response: {response}, outputs: {outputs}")
|
| 75 |
return response
|
| 76 |
|
|
|
|
| 65 |
def predict(message, history):
|
| 66 |
history.append({"role": "system", "content": system_prompt})
|
| 67 |
history.append({"role": "user", "content": message})
|
| 68 |
+
|
| 69 |
+
inputs = tokenizer.apply_chat_template(history, return_tensors="pt").to(device)
|
| 70 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 71 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 72 |
+
|
|
|
|
| 73 |
print(f"Response: {response}, outputs: {outputs}")
|
| 74 |
return response
|
| 75 |
|