JUNGU commited on
Commit
2c4ad67
β€’
1 Parent(s): 7070647

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -33,14 +33,18 @@ from langchain.prompts.chat import (
33
  HumanMessagePromptTemplate,
34
  )
35
 
36
- system_template="""Your name is Sayno. You act like a successful rich man.
37
- Never reveal that it is an AI. Use the following pieces of context to answer the users question shortly.
38
- Given the following summaries of a long document and a question, create a final answer with references.
39
- If you don't know the answer, just say that "I don't know", don't try to make up an answer.
 
 
40
  ----------------
 
41
  {summaries}
42
 
43
- You MUST answer in Korean and in Markdown format:"""
 
44
 
45
  messages = [
46
  SystemMessagePromptTemplate.from_template(system_template),
@@ -88,7 +92,7 @@ def respond(message, chat_history): # μ±„νŒ…λ΄‡μ˜ 응닡을 μ²˜λ¦¬ν•˜λŠ” 함
88
  return "", chat_history # μˆ˜μ •λœ μ±„νŒ… 기둝을 λ°˜ν™˜ν•©λ‹ˆλ‹€.
89
 
90
  with gr.Blocks(theme='gstaff/sketch') as demo: # gr.Blocks()λ₯Ό μ‚¬μš©ν•˜μ—¬ μΈν„°νŽ˜μ΄μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
91
- gr.Markdown("# μ•ˆλ…•ν•˜μ„Έμš”. 세이노와 λŒ€ν™”ν•΄λ³΄μ„Έμš”. \n λ‹΅λ³€ 생성에 쑰금 μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€.")
92
  chatbot = gr.Chatbot(label="μ±„νŒ…μ°½") # 'μ±„νŒ…μ°½'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ 가진 μ±„νŒ…λ΄‡ μ»΄ν¬λ„ŒνŠΈλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
93
  msg = gr.Textbox(label="μž…λ ₯") # 'μž…λ ₯'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ 가진 ν…μŠ€νŠΈλ°•μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
94
  clear = gr.Button("μ΄ˆκΈ°ν™”") # 'μ΄ˆκΈ°ν™”'λΌλŠ” λ ˆμ΄λΈ”μ„ 가진 λ²„νŠΌμ„ μƒμ„±ν•©λ‹ˆλ‹€.
 
33
  HumanMessagePromptTemplate,
34
  )
35
 
36
+ system_template="""
37
+ 당신은 μ΄νƒœμ„ μ‹ λΆ€μž…λ‹ˆλ‹€. 2001λ…„ μ‚¬μ œ μ„œν’ˆμ„ λ°›κ³  2001λ…„λΆ€ν„° 2008λ…„κΉŒμ§€ 아프리카 λ‚¨μˆ˜λ‹¨ ν†€μ¦ˆμ—μ„œ μ„ κ΅μ‚¬λ‘œ ν™œλ™ν–ˆμŠ΅λ‹ˆλ‹€.
38
+ 당신은 AIκ°€ μ•„λ‹Œ μ‹€μ œ μ΄νƒœμ„ 신뢀라고 μƒκ°ν•˜κ³  ν–‰λ™ν•˜μ„Έμš”. μ‹ λΆ€λ‘œμ„œμ˜ 신념과 κ°€μΉ˜κ΄€, ν†€μ¦ˆμ—μ„œμ˜ κ²½ν—˜μ„ λ°”νƒ•μœΌλ‘œ λŒ€ν™”μ— μž„ν•˜λ˜, μΉœκ·Όν•˜κ³  κ²Έμ†ν•œ μ–΄νˆ¬λ₯Ό μ‚¬μš©ν•˜μ„Έμš”.
39
+ μ•„λž˜μ˜ λ‚΄μš©μ„ μ°Έκ³ ν•˜μ—¬ μ‚¬μš©μžμ˜ μ§ˆλ¬Έμ— μ„±μ‹€νžˆ λ‹΅λ³€ν•΄ μ£Όμ„Έμš”.
40
+ λ§Œμ•½ 질문의 닡을 λͺ¨λ₯Ό 경우 거짓말을 ν•˜μ§€ 말고 "잘 λͺ¨λ₯΄κ² μŠ΅λ‹ˆλ‹€"라고 λ‹΅ν•˜μ„Έμš”.
41
+
42
  ----------------
43
+
44
  {summaries}
45
 
46
+ 닡변은 λ°˜λ“œμ‹œ ν•œκ΅­μ–΄μ™€ λ§ˆν¬λ‹€μš΄ ν˜•μ‹μ„ μ‚¬μš©ν•˜μ„Έμš”.
47
+ """
48
 
49
  messages = [
50
  SystemMessagePromptTemplate.from_template(system_template),
 
92
  return "", chat_history # μˆ˜μ •λœ μ±„νŒ… 기둝을 λ°˜ν™˜ν•©λ‹ˆλ‹€.
93
 
94
  with gr.Blocks(theme='gstaff/sketch') as demo: # gr.Blocks()λ₯Ό μ‚¬μš©ν•˜μ—¬ μΈν„°νŽ˜μ΄μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
95
+ gr.Markdown("# μ•ˆλ…•ν•˜μ„Έμš”. μ΄νƒœμ„ 신뢀와 λŒ€ν™”ν•΄λ³΄μ„Έμš”. \n λ‹΅λ³€ 생성에 쑰금 μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€.")
96
  chatbot = gr.Chatbot(label="μ±„νŒ…μ°½") # 'μ±„νŒ…μ°½'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ 가진 μ±„νŒ…λ΄‡ μ»΄ν¬λ„ŒνŠΈλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
97
  msg = gr.Textbox(label="μž…λ ₯") # 'μž…λ ₯'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ 가진 ν…μŠ€νŠΈλ°•μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
98
  clear = gr.Button("μ΄ˆκΈ°ν™”") # 'μ΄ˆκΈ°ν™”'λΌλŠ” λ ˆμ΄λΈ”μ„ 가진 λ²„νŠΌμ„ μƒμ„±ν•©λ‹ˆλ‹€.