ldhldh commited on
Commit
8625f54
โ€ข
1 Parent(s): c56ddd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -40,8 +40,9 @@ llm = Llama(model_path = 'Llama-2-ko-7B-chat-gguf-q4_0.bin',
40
  )
41
  # App code
42
  def chat(x):
43
- output = llm(f"๋‹ค์Œ์€ A์™€ B์˜ ์—ญํ• ๊ทน์ด์•ผ. ๋„ˆ๋Š” B์•ผ. A์™€ ๋Œ€ํ™”ํ•˜๊ณ  ์žˆ์–ด. ์นœ๊ตฌ์—๊ฒŒ ์นœ๊ทผํ•˜๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ž˜ ๋Œ€๋‹ตํ•ด์ค˜.\n\n### A:\n{x}\n\n### B:\n", max_tokens=20, stop=["###"], echo=True)
44
- return output['choices'][0]['text'][len("๋‹ค์Œ์€ A์™€ B์˜ ์—ญํ• ๊ทน์ด์•ผ. ๋„ˆ๋Š” B์•ผ. A์™€ ๋Œ€ํ™”ํ•˜๊ณ  ์žˆ์–ด. ์นœ๊ตฌ์—๊ฒŒ ์นœ๊ทผํ•˜๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ž˜ ๋Œ€๋‹ตํ•ด์ค˜."):-1]
 
45
 
46
 
47
  with gr.Blocks() as demo:
 
40
  )
41
  # App code
42
  def chat(x):
43
+ prom = f"๋‹ค์Œ์€ A์™€ B์˜ ์—ญํ• ๊ทน์ด์•ผ. ๋„ˆ๋Š” B์•ผ. A์™€ ๋Œ€ํ™”ํ•˜๊ณ  ์žˆ์–ด. ์นœ๊ตฌ์—๊ฒŒ ์นœ๊ทผํ•˜๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ž˜ ๋Œ€๋‹ตํ•ด์ค˜.\n\n### A:\n{x}\n\n### B:\n"
44
+ output = llm(prom, max_tokens=20, stop=["###"], echo=True)
45
+ return output['choices'][0]['text'][len(prom):-1]
46
 
47
 
48
  with gr.Blocks() as demo: