Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ PROMPT_TEMPLATE = "<|im_start|>{user_name}\n{query}{separator}\n<|im_start|>{ass
|
|
22 |
repo = None
|
23 |
|
24 |
|
25 |
-
def get_total_inputs(inputs, chatbot, preprompt, user_name, assistant_name, sep):
|
26 |
past = []
|
27 |
for data in chatbot:
|
28 |
user_data, model_data = data
|
@@ -57,7 +57,8 @@ def generate(
|
|
57 |
header,
|
58 |
user_name,
|
59 |
assistant_name,
|
60 |
-
separator
|
|
|
61 |
):
|
62 |
# Don't return meaningless message when the input is empty
|
63 |
if not user_message:
|
@@ -113,7 +114,7 @@ def generate(
|
|
113 |
truncate=1024,
|
114 |
# seed=42,
|
115 |
# stop_sequences=[user_name, DEFAULT_SEPARATOR]
|
116 |
-
stop_sequences=[DEFAULT_SEPARATOR]
|
117 |
)
|
118 |
|
119 |
# print(prompt)
|
@@ -271,7 +272,11 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
|
271 |
interactive=True,
|
272 |
info="Character to be used when the speaker changes in the prompt",
|
273 |
)
|
274 |
-
|
|
|
|
|
|
|
|
|
275 |
history = gr.State([])
|
276 |
last_user_message = gr.State("")
|
277 |
|
@@ -288,7 +293,8 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
|
288 |
header,
|
289 |
user_name,
|
290 |
assistant_name,
|
291 |
-
separator
|
|
|
292 |
],
|
293 |
outputs=[chatbot, history, last_user_message, user_message],
|
294 |
)
|
@@ -306,7 +312,8 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
|
306 |
header,
|
307 |
user_name,
|
308 |
assistant_name,
|
309 |
-
separator
|
|
|
310 |
],
|
311 |
outputs=[chatbot, history, last_user_message, user_message],
|
312 |
)
|
|
|
22 |
repo = None
|
23 |
|
24 |
|
25 |
+
def get_total_inputs(inputs, chatbot, preprompt, user_name, assistant_name, sep, stop_seq):
|
26 |
past = []
|
27 |
for data in chatbot:
|
28 |
user_data, model_data = data
|
|
|
57 |
header,
|
58 |
user_name,
|
59 |
assistant_name,
|
60 |
+
separator,
|
61 |
+
stop_seq
|
62 |
):
|
63 |
# Don't return meaningless message when the input is empty
|
64 |
if not user_message:
|
|
|
114 |
truncate=1024,
|
115 |
# seed=42,
|
116 |
# stop_sequences=[user_name, DEFAULT_SEPARATOR]
|
117 |
+
stop_sequences=[DEFAULT_SEPARATOR, stop_seq]
|
118 |
)
|
119 |
|
120 |
# print(prompt)
|
|
|
272 |
interactive=True,
|
273 |
info="Character to be used when the speaker changes in the prompt",
|
274 |
)
|
275 |
+
stop_seq = gr.Textbox(
|
276 |
+
label="Stop sequence",
|
277 |
+
value=DEFAULT_SEPARATOR,
|
278 |
+
interactive=True,
|
279 |
+
info="Secondary stop Sequence character")
|
280 |
history = gr.State([])
|
281 |
last_user_message = gr.State("")
|
282 |
|
|
|
293 |
header,
|
294 |
user_name,
|
295 |
assistant_name,
|
296 |
+
separator,
|
297 |
+
stop_seq
|
298 |
],
|
299 |
outputs=[chatbot, history, last_user_message, user_message],
|
300 |
)
|
|
|
312 |
header,
|
313 |
user_name,
|
314 |
assistant_name,
|
315 |
+
separator,
|
316 |
+
stop_seq
|
317 |
],
|
318 |
outputs=[chatbot, history, last_user_message, user_message],
|
319 |
)
|