Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -56,8 +56,13 @@ def predict(_chatbot, task_history, user_input):
|
|
56 |
audio_idx = 1
|
57 |
pre = ""
|
58 |
last_audio = None
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
-
for i, (q, a) in enumerate(history_cp):
|
61 |
if isinstance(q, (tuple, list)):
|
62 |
last_audio = q[0]
|
63 |
q = f'Audio {audio_idx}: <audio>{q[0]}</audio>'
|
@@ -68,6 +73,9 @@ def predict(_chatbot, task_history, user_input):
|
|
68 |
history_filter.append((pre, a))
|
69 |
pre = ""
|
70 |
|
|
|
|
|
|
|
71 |
history, message = history_filter[:-1], history_filter[-1][0]
|
72 |
response, history = model.chat(tokenizer, message, history=history)
|
73 |
|
|
|
56 |
audio_idx = 1
|
57 |
pre = ""
|
58 |
last_audio = None
|
59 |
+
for i, item in enumerate(history_cp):
|
60 |
+
if len(item) != 2:
|
61 |
+
print(f"Error: Expected a tuple of length 2, but got {item}")
|
62 |
+
continue
|
63 |
+
|
64 |
+
q, a = item
|
65 |
|
|
|
66 |
if isinstance(q, (tuple, list)):
|
67 |
last_audio = q[0]
|
68 |
q = f'Audio {audio_idx}: <audio>{q[0]}</audio>'
|
|
|
73 |
history_filter.append((pre, a))
|
74 |
pre = ""
|
75 |
|
76 |
+
if not history_filter:
|
77 |
+
return _chatbot
|
78 |
+
|
79 |
history, message = history_filter[:-1], history_filter[-1][0]
|
80 |
response, history = model.chat(tokenizer, message, history=history)
|
81 |
|