kastan commited on
Commit
1bc97a8
Β·
1 Parent(s): 95890a2

removing double newlines, somehow getting added

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -133,7 +133,9 @@ def predict(
133
  cleaned_final_chat_response = []
134
  for human_chat, bot_chat in final_chat_response:
135
  human_chat = human_chat.replace("<br>", "")
 
136
  bot_chat = bot_chat.replace("<br>", "")
 
137
  cleaned_final_chat_response.append( (human_chat, bot_chat) )
138
 
139
  print(">>>>>>>>>>>> KEYY. final_chat_response -- AFTER CLEANING -----:", cleaned_final_chat_response)
@@ -141,16 +143,12 @@ def predict(
141
  # Pinecone context retrieval
142
  top_context_list = ta.retrieve_contexts_from_pinecone(user_question=inputs, topk=NUM_ANSWERS_GENERATED)
143
  # yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], []
144
- print("2. final_chat_response", final_chat_response)
145
- print("2. history:", history)
146
- yield None, history, top_context_list[0], top_context_list[1], top_context_list[2], []
147
 
148
- print("3. final_chat_response", final_chat_response)
149
- print("3. history:", history)
150
  # run CLIP
151
  images_list = ta.clip_text_to_image(inputs)
152
  # yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
153
- yield None, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
154
 
155
 
156
  def reset_textbox():
 
133
  cleaned_final_chat_response = []
134
  for human_chat, bot_chat in final_chat_response:
135
  human_chat = human_chat.replace("<br>", "")
136
+ human_chat = human_chat.replace("\n\n", "\n")
137
  bot_chat = bot_chat.replace("<br>", "")
138
+ bot_chat = bot_chat.replace("\n\n", "\n")
139
  cleaned_final_chat_response.append( (human_chat, bot_chat) )
140
 
141
  print(">>>>>>>>>>>> KEYY. final_chat_response -- AFTER CLEANING -----:", cleaned_final_chat_response)
 
143
  # Pinecone context retrieval
144
  top_context_list = ta.retrieve_contexts_from_pinecone(user_question=inputs, topk=NUM_ANSWERS_GENERATED)
145
  # yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], []
146
+ yield cleaned_final_chat_response, history, top_context_list[0], top_context_list[1], top_context_list[2], []
 
 
147
 
 
 
148
  # run CLIP
149
  images_list = ta.clip_text_to_image(inputs)
150
  # yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
151
+ yield cleaned_final_chat_response, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
152
 
153
 
154
  def reset_textbox():