Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -50,12 +50,18 @@ model = model.to(device)
|
|
50 |
# Spacesμ GPU μμμ μ¬μ©νμ¬ chat ν¨μ μ€ν. μ΅λ 60μ΄ λμ GPU μμ μ¬μ© κ°λ₯.
|
51 |
@spaces.GPU(duration=60)
|
52 |
def chat(message, history, temperature, do_sample, max_tokens):
|
|
|
53 |
# μ±ν
κΈ°λ‘μ μ μ ν νμμΌλ‘ λ³ν
|
54 |
chat = []
|
55 |
for item in history:
|
56 |
chat.append({"role": "user", "content": item[0]})
|
57 |
if item[1] is not None:
|
58 |
chat.append({"role": "assistant", "content": item[1]})
|
|
|
|
|
|
|
|
|
|
|
59 |
chat.append({"role": "user", "content": message})
|
60 |
|
61 |
# ν ν¬λμ΄μ λ₯Ό μ¬μ©νμ¬ μ
λ ₯ μ²λ¦¬
|
|
|
50 |
# Spacesμ GPU μμμ μ¬μ©νμ¬ chat ν¨μ μ€ν. μ΅λ 60μ΄ λμ GPU μμ μ¬μ© κ°λ₯.
|
51 |
@spaces.GPU(duration=60)
|
52 |
def chat(message, history, temperature, do_sample, max_tokens):
|
53 |
+
instruction = "You are a helpful assistant. Please respond to the user's message politely and informatively"
|
54 |
# μ±ν
κΈ°λ‘μ μ μ ν νμμΌλ‘ λ³ν
|
55 |
chat = []
|
56 |
for item in history:
|
57 |
chat.append({"role": "user", "content": item[0]})
|
58 |
if item[1] is not None:
|
59 |
chat.append({"role": "assistant", "content": item[1]})
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
chat.insert(0, {"role":, "system", "content": instruction})
|
64 |
+
|
65 |
chat.append({"role": "user", "content": message})
|
66 |
|
67 |
# ν ν¬λμ΄μ λ₯Ό μ¬μ©νμ¬ μ
λ ₯ μ²λ¦¬
|