Spaces:
Runtime error
Runtime error
Update app_dialogue.py
Browse files- app_dialogue.py +10 -2
app_dialogue.py
CHANGED
@@ -672,14 +672,22 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
|
|
672 |
],
|
673 |
)
|
674 |
|
675 |
-
def
|
676 |
if len(chat_history) == 0:
|
677 |
-
return gr.Update(), gr.
|
678 |
last_interaction = chat_history[-1]
|
679 |
chat_history = chat_history[:-1]
|
680 |
chat_update = gr.update(value=chat_history)
|
681 |
text_update = gr.update(value=last_interaction[0])
|
682 |
return chat_update, text_update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
|
684 |
regenerate_btn.click(fn=remove_last_turn, inputs=chatbot, outputs=[chatbot, textbox]).then(
|
685 |
fn=model_inference,
|
|
|
672 |
],
|
673 |
)
|
674 |
|
675 |
+
def remove_last_turn_OLD(chat_history):
|
676 |
if len(chat_history) == 0:
|
677 |
+
return gr.Update(), gr.update()
|
678 |
last_interaction = chat_history[-1]
|
679 |
chat_history = chat_history[:-1]
|
680 |
chat_update = gr.update(value=chat_history)
|
681 |
text_update = gr.update(value=last_interaction[0])
|
682 |
return chat_update, text_update
|
683 |
+
def remove_last_turn(chat_history):
|
684 |
+
if len(chat_history) == 0:
|
685 |
+
return None, None
|
686 |
+
last_interaction = chat_history[-1]
|
687 |
+
chat_history = chat_history[:-1]
|
688 |
+
chat_update = gr.update(value=chat_history)
|
689 |
+
text_update = gr.update(value=last_interaction[0])
|
690 |
+
return chat_update, text_update
|
691 |
|
692 |
regenerate_btn.click(fn=remove_last_turn, inputs=chatbot, outputs=[chatbot, textbox]).then(
|
693 |
fn=model_inference,
|