KorWoody commited on
Commit
be0b516
Β·
1 Parent(s): 9efb349

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -37,13 +37,13 @@ def LoadData(openai_key):
37
 
38
 
39
  # μ±—λ΄‡μ˜ 닡변을 μ²˜λ¦¬ν•˜λŠ” ν•¨μˆ˜
40
- def respond(message, chat_history, temperature):
41
  try:
42
 
43
  print(temperature)
44
 
45
  qa_chain = RetrievalQA.from_chain_type(
46
- llm=OpenAI(temperature=temperature),
47
  # llm=OpenAI(temperature=0.4),
48
  # llm=ChatOpenAI(temperature=0),
49
  chain_type="stuff",
@@ -91,13 +91,21 @@ with gr.Blocks(css=css) as UnivChatbot:
91
  langchain_status = gr.Textbox(placeholder="Status", interactive=False, show_label=False, container=False)
92
 
93
  with gr.Row():
94
- with gr.Column(scale=5):
95
  temperature = gr.Slider(
96
  label="Temperature",
97
  minimum=0.1,
98
  maximum=2.0,
99
  step=0.1,
100
- value=0.1,
 
 
 
 
 
 
 
 
101
  )
102
  with gr.Column(scale=1):
103
  chk_key = gr.Button("확인", variant="primary")
@@ -125,11 +133,11 @@ with gr.Blocks(css=css) as UnivChatbot:
125
  # μ‚¬μš©μžμ˜ μž…λ ₯을 제좜(submit)ν•˜λ©΄ respond ν•¨μˆ˜κ°€ 호좜.
126
  msg.submit(
127
  fn=respond,
128
- inputs=[msg, chatbot, temperature],
129
  outputs=[msg, chatbot]
130
  )
131
 
132
- submit.click(respond, [msg, chatbot, temperature], [msg, chatbot])
133
 
134
  # 'μ΄ˆκΈ°ν™”' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ±„νŒ… 기둝을 μ΄ˆκΈ°ν™”.
135
  clear.click(lambda: None, None, chatbot, queue=False)
 
37
 
38
 
39
  # μ±—λ΄‡μ˜ 닡변을 μ²˜λ¦¬ν•˜λŠ” ν•¨μˆ˜
40
+ def respond(message, chat_history, temperature, top_p):
41
  try:
42
 
43
  print(temperature)
44
 
45
  qa_chain = RetrievalQA.from_chain_type(
46
+ llm=OpenAI(temperature=temperature, top_p=top_p),
47
  # llm=OpenAI(temperature=0.4),
48
  # llm=ChatOpenAI(temperature=0),
49
  chain_type="stuff",
 
91
  langchain_status = gr.Textbox(placeholder="Status", interactive=False, show_label=False, container=False)
92
 
93
  with gr.Row():
94
+ with gr.Column(scale=4):
95
  temperature = gr.Slider(
96
  label="Temperature",
97
  minimum=0.1,
98
  maximum=2.0,
99
  step=0.1,
100
+ value=0.7,
101
+ )
102
+ with gr.Column(scale=4):
103
+ top_p = gr.Slider(
104
+ label="Top_p",
105
+ minimum=0.1,
106
+ maximum=1,
107
+ step=0.1,
108
+ value=0.5,
109
  )
110
  with gr.Column(scale=1):
111
  chk_key = gr.Button("확인", variant="primary")
 
133
  # μ‚¬μš©μžμ˜ μž…λ ₯을 제좜(submit)ν•˜λ©΄ respond ν•¨μˆ˜κ°€ 호좜.
134
  msg.submit(
135
  fn=respond,
136
+ inputs=[msg, chatbot, temperature, top_p],
137
  outputs=[msg, chatbot]
138
  )
139
 
140
+ submit.click(respond, [msg, chatbot, temperature, top_p], [msg, chatbot])
141
 
142
  # 'μ΄ˆκΈ°ν™”' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ±„νŒ… 기둝을 μ΄ˆκΈ°ν™”.
143
  clear.click(lambda: None, None, chatbot, queue=False)