Spaces:
Runtime error
Runtime error
chat history via final_chat_response
Browse files
app.py
CHANGED
@@ -106,6 +106,7 @@ def predict(
|
|
106 |
stop_sequences=[user_name.rstrip(), assistant_name.rstrip()],
|
107 |
)
|
108 |
|
|
|
109 |
for i, response in enumerate(iterator):
|
110 |
if response.token.special:
|
111 |
continue
|
@@ -122,19 +123,18 @@ def predict(
|
|
122 |
history[-1] = partial_words
|
123 |
|
124 |
chat = [(history[i].strip(), history[i + 1].strip()) for i in range(0, len(history) - 1, 2)]
|
|
|
125 |
yield chat, history, None, None, None, []
|
126 |
|
127 |
-
chat = [(history[i].strip(), history[i + 1].strip()) for i in range(0, len(history) - 1, 2)]
|
128 |
-
|
129 |
# Pinecone context retrieval
|
130 |
top_context_list = ta.retrieve_contexts_from_pinecone(user_question=inputs, topk=NUM_ANSWERS_GENERATED)
|
131 |
# yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], []
|
132 |
-
yield
|
133 |
|
134 |
# run CLIP
|
135 |
images_list = ta.clip_text_to_image(inputs)
|
136 |
# yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
|
137 |
-
yield
|
138 |
|
139 |
|
140 |
def reset_textbox():
|
|
|
106 |
stop_sequences=[user_name.rstrip(), assistant_name.rstrip()],
|
107 |
)
|
108 |
|
109 |
+
final_chat_response = None
|
110 |
for i, response in enumerate(iterator):
|
111 |
if response.token.special:
|
112 |
continue
|
|
|
123 |
history[-1] = partial_words
|
124 |
|
125 |
chat = [(history[i].strip(), history[i + 1].strip()) for i in range(0, len(history) - 1, 2)]
|
126 |
+
final_chat_response = chat
|
127 |
yield chat, history, None, None, None, []
|
128 |
|
|
|
|
|
129 |
# Pinecone context retrieval
|
130 |
top_context_list = ta.retrieve_contexts_from_pinecone(user_question=inputs, topk=NUM_ANSWERS_GENERATED)
|
131 |
# yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], []
|
132 |
+
yield final_chat_response, history, top_context_list[0], top_context_list[1], top_context_list[2], []
|
133 |
|
134 |
# run CLIP
|
135 |
images_list = ta.clip_text_to_image(inputs)
|
136 |
# yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
|
137 |
+
yield final_chat_response, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
|
138 |
|
139 |
|
140 |
def reset_textbox():
|