Remove regenerate
Browse files
app.py
CHANGED
@@ -126,6 +126,7 @@ def generate(
|
|
126 |
do_sample=True,
|
127 |
truncate=999,
|
128 |
seed=42,
|
|
|
129 |
stop_sequences=["<|end|>"],
|
130 |
)
|
131 |
|
@@ -165,30 +166,30 @@ examples = [
|
|
165 |
]
|
166 |
|
167 |
|
168 |
-
def regenerate(
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
):
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
|
193 |
|
194 |
def clear_chat():
|
@@ -275,7 +276,7 @@ with gr.Blocks(theme=theme, analytics_enabled=False, css=custom_css) as demo:
|
|
275 |
user_message = gr.Textbox(placeholder="Enter your message here", show_label=False, elem_id="q-input")
|
276 |
with gr.Row():
|
277 |
send_button = gr.Button("Send", elem_id="send-btn", visible=True)
|
278 |
-
regenerate_button = gr.Button("Regenerate", elem_id="send-btn", visible=True)
|
279 |
|
280 |
clear_chat_button = gr.Button("Clear chat", elem_id="clear-btn", visible=True)
|
281 |
|
@@ -366,21 +367,21 @@ with gr.Blocks(theme=theme, analytics_enabled=False, css=custom_css) as demo:
|
|
366 |
outputs=[chatbot, history, last_user_message, user_message],
|
367 |
)
|
368 |
|
369 |
-
regenerate_button.click(
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
)
|
384 |
|
385 |
clear_chat_button.click(clear_chat, outputs=[chatbot, history])
|
386 |
# share_button.click(None, [], [], _js=share_js)
|
|
|
126 |
do_sample=True,
|
127 |
truncate=999,
|
128 |
seed=42,
|
129 |
+
repetition_penalty=1.2,
|
130 |
stop_sequences=["<|end|>"],
|
131 |
)
|
132 |
|
|
|
166 |
]
|
167 |
|
168 |
|
169 |
+
# def regenerate(
|
170 |
+
# system_message,
|
171 |
+
# user_message,
|
172 |
+
# chatbot,
|
173 |
+
# history,
|
174 |
+
# temperature=0.5,
|
175 |
+
# top_p=0.25,
|
176 |
+
# top_k=50,
|
177 |
+
# max_new_tokens=512,
|
178 |
+
# do_save=True,
|
179 |
+
# ):
|
180 |
+
# # Do nothing if there's no history
|
181 |
+
# if has_no_history(chatbot, history):
|
182 |
+
# return (
|
183 |
+
# chatbot,
|
184 |
+
# history,
|
185 |
+
# user_message,
|
186 |
+
# "",
|
187 |
+
# )
|
188 |
+
|
189 |
+
# chatbot = chatbot[:-1]
|
190 |
+
# history = history[:-2]
|
191 |
+
|
192 |
+
# return generate(system_message, user_message, chatbot, history, temperature, top_p, top_k, max_new_tokens, do_save)
|
193 |
|
194 |
|
195 |
def clear_chat():
|
|
|
276 |
user_message = gr.Textbox(placeholder="Enter your message here", show_label=False, elem_id="q-input")
|
277 |
with gr.Row():
|
278 |
send_button = gr.Button("Send", elem_id="send-btn", visible=True)
|
279 |
+
# regenerate_button = gr.Button("Regenerate", elem_id="send-btn", visible=True)
|
280 |
|
281 |
clear_chat_button = gr.Button("Clear chat", elem_id="clear-btn", visible=True)
|
282 |
|
|
|
367 |
outputs=[chatbot, history, last_user_message, user_message],
|
368 |
)
|
369 |
|
370 |
+
# regenerate_button.click(
|
371 |
+
# regenerate,
|
372 |
+
# inputs=[
|
373 |
+
# system_message,
|
374 |
+
# last_user_message,
|
375 |
+
# chatbot,
|
376 |
+
# history,
|
377 |
+
# temperature,
|
378 |
+
# top_p,
|
379 |
+
# top_k,
|
380 |
+
# max_new_tokens,
|
381 |
+
# do_save,
|
382 |
+
# ],
|
383 |
+
# outputs=[chatbot, history, last_user_message, user_message],
|
384 |
+
# )
|
385 |
|
386 |
clear_chat_button.click(clear_chat, outputs=[chatbot, history])
|
387 |
# share_button.click(None, [], [], _js=share_js)
|