JUNGU commited on
Commit
f30c750
Β·
verified Β·
1 Parent(s): fb8a0a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
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
  # ν† ν¬λ‚˜μ΄μ €λ₯Ό μ‚¬μš©ν•˜μ—¬ μž…λ ₯ 처리