Spaces:
Running
on
Zero
Running
on
Zero
remove none
Browse files
app.py
CHANGED
@@ -60,15 +60,12 @@ For an optimal experience, please use desktop computers for this demo, as mobile
|
|
60 |
"""
|
61 |
|
62 |
def regenerate(state, image_process_mode):
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
return (state, state.to_gradio_chatbot(), "", None)
|
70 |
-
else:
|
71 |
-
return (None, "", "", None)
|
72 |
|
73 |
|
74 |
def clear_history():
|
@@ -258,9 +255,6 @@ def get_response(params):
|
|
258 |
|
259 |
|
260 |
def http_bot(state, temperature, top_p, max_new_tokens):
|
261 |
-
if state is None:
|
262 |
-
return (None, "")
|
263 |
-
|
264 |
if state.skip_next:
|
265 |
# This generate call is skipped due to invalid inputs
|
266 |
yield (state, state.to_gradio_chatbot())
|
|
|
60 |
"""
|
61 |
|
62 |
def regenerate(state, image_process_mode):
|
63 |
+
state.messages[-1][-1] = None
|
64 |
+
prev_human_msg = state.messages[-2]
|
65 |
+
if type(prev_human_msg[1]) in (tuple, list):
|
66 |
+
prev_human_msg[1] = (*prev_human_msg[1][:2], image_process_mode)
|
67 |
+
state.skip_next = False
|
68 |
+
return (state, state.to_gradio_chatbot(), "", None)
|
|
|
|
|
|
|
69 |
|
70 |
|
71 |
def clear_history():
|
|
|
255 |
|
256 |
|
257 |
def http_bot(state, temperature, top_p, max_new_tokens):
|
|
|
|
|
|
|
258 |
if state.skip_next:
|
259 |
# This generate call is skipped due to invalid inputs
|
260 |
yield (state, state.to_gradio_chatbot())
|