Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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=
|
95 |
temperature = gr.Slider(
|
96 |
label="Temperature",
|
97 |
minimum=0.1,
|
98 |
maximum=2.0,
|
99 |
step=0.1,
|
100 |
-
value=0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|