FredZhang7
commited on
Commit
•
648b6a9
1
Parent(s):
8f494a0
add slider fields to chat api
Browse files
app.py
CHANGED
@@ -212,18 +212,8 @@ with gr.Blocks(title=title) as demo:
|
|
212 |
history = history or []
|
213 |
return "", history + [[message, None]]
|
214 |
|
215 |
-
def respond(history=None):
|
216 |
-
global token_count_chat, temperature_chat, top_p_chat, presence_penalty_chat, count_penalty_chat
|
217 |
-
|
218 |
-
# get the lastest user message and the additional parameters
|
219 |
instruction = history[-1][0]
|
220 |
-
token_count = token_count_chat.value
|
221 |
-
|
222 |
-
temperature = temperature_chat.value
|
223 |
-
top_p = top_p_chat.value
|
224 |
-
presence_penalty = presence_penalty_chat.value
|
225 |
-
count_penalty = count_penalty_chat.value
|
226 |
-
|
227 |
history[-1][1] = ""
|
228 |
|
229 |
for character in generator(
|
@@ -240,7 +230,7 @@ with gr.Blocks(title=title) as demo:
|
|
240 |
yield history
|
241 |
|
242 |
msg.submit(user_msg, [msg, chatbot], [msg, chatbot], queue=False).then(
|
243 |
-
respond, chatbot, chatbot, api_name="chat"
|
244 |
)
|
245 |
|
246 |
with gr.Tab("Instruct mode"):
|
|
|
212 |
history = history or []
|
213 |
return "", history + [[message, None]]
|
214 |
|
215 |
+
def respond(history=None, token_count, temperature, top_p, presence_penalty, count_penalty):
|
|
|
|
|
|
|
216 |
instruction = history[-1][0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
history[-1][1] = ""
|
218 |
|
219 |
for character in generator(
|
|
|
230 |
yield history
|
231 |
|
232 |
msg.submit(user_msg, [msg, chatbot], [msg, chatbot], queue=False).then(
|
233 |
+
respond, [chatbot, token_count_chat, temperature_chat, top_p_chat, presence_penalty_chat, count_penalty_chat], chatbot, api_name="chat"
|
234 |
)
|
235 |
|
236 |
with gr.Tab("Instruct mode"):
|