devvtaco commited on
Commit
dc5e80d
ยท
verified ยท
1 Parent(s): fb5e935

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -19,9 +19,17 @@ def chat_with_model(message, history):
19
  if not loading_done:
20
  return history + [[message, "โš ๏ธ ๋ชจ๋ธ์ด ์•„์ง ๋กœ๋”ฉ ์ค‘์ž…๋‹ˆ๋‹ค. ์ž ์‹œ๋งŒ ๊ธฐ๋‹ค๋ ค ์ฃผ์„ธ์š”."]]
21
 
22
- prompt = f"๋‹ค์Œ ๋ฌธ์žฅ์„ ๋ถ„์„ํ•˜๊ณ , ๋ฌด๋ก€ํ•˜๊ฑฐ๋‚˜ ๊ณต๊ฒฉ์ ์ธ ํ‘œํ˜„์ด ์žˆ์œผ๋ฉด ์•Œ๋ ค์ฃผ๊ณ  ๋” ์˜ˆ์˜ ์žˆ๊ฒŒ ๋ฐ”๊ฟ”์ค˜:\n\n{message}"
 
 
 
 
 
 
 
23
  response = chat_model(prompt, max_new_tokens=200)[0]['generated_text']
24
- return history + [[message, response]]
 
25
 
26
  # ์ƒํƒœ ํ…์ŠคํŠธ ๋ฐ˜ํ™˜ ํ•จ์ˆ˜ (๋งค๋ฒˆ ์ƒˆ๋กœ ์ฝ์–ด์˜ด)
27
  def get_status():
 
19
  if not loading_done:
20
  return history + [[message, "โš ๏ธ ๋ชจ๋ธ์ด ์•„์ง ๋กœ๋”ฉ ์ค‘์ž…๋‹ˆ๋‹ค. ์ž ์‹œ๋งŒ ๊ธฐ๋‹ค๋ ค ์ฃผ์„ธ์š”."]]
21
 
22
+ prompt = f"""
23
+ ### Instruction: ๋‹ค์Œ ๋ฌธ์žฅ์„ ๋ถ„์„ํ•ด์„œ ๋ฌด๋ก€ํ•˜๊ฑฐ๋‚˜ ๊ณต๊ฒฉ์ ์ธ ํ‘œํ˜„์ด ์žˆ๋Š”์ง€ ํŒ๋‹จํ•˜๊ณ , ์žˆ๋‹ค๋ฉด ๋” ์˜ˆ์˜ ์žˆ๊ฒŒ ๊ณ ์ณ์ค˜.
24
+
25
+ ### Input:
26
+ {message}
27
+
28
+ ### Response:
29
+ """
30
  response = chat_model(prompt, max_new_tokens=200)[0]['generated_text']
31
+ response_only = response[len(prompt):].strip()
32
+ return history + [[message, response_only]]
33
 
34
  # ์ƒํƒœ ํ…์ŠคํŠธ ๋ฐ˜ํ™˜ ํ•จ์ˆ˜ (๋งค๋ฒˆ ์ƒˆ๋กœ ์ฝ์–ด์˜ด)
35
  def get_status():