Karthikeyan commited on
Commit
ad144a6
1 Parent(s): cf14d70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -184,16 +184,11 @@ class LangChain_Document_QA:
184
  message = response.choices[0].text.strip()
185
  if ":" in message:
186
  message = re.sub(r'^.*:', '', message)
187
-
188
- response = message.strip()
189
- history[-1][1] = response
190
- history_state.value = history
191
- return history
192
  except:
193
  return "How can I help you?"
194
 
195
 
196
-
197
  def _text_box(self,customer_emotion,customer_sentiment_score):
198
  sentiment_str = ', '.join([f'{label}: {score}' for label, score in zip(customer_sentiment_score['Sentiment'], customer_sentiment_score['Score'])])
199
  #emotion_str = ', '.join([f'{emotion}: {score}' for emotion, score in zip(customer_emotion['Emotion'], customer_emotion['Score'])])
@@ -274,8 +269,8 @@ class LangChain_Document_QA:
274
 
275
  txt_msg = txt.submit(self._add_text, [chatbot, txt], [chatbot, txt])
276
  txt_msg.then(lambda: gr.update(interactive=True), None, [txt])
277
- txt.submit(self._suggested_answer,txt,chatbot)
278
- #button.click(self._agent_text, [chatbot,txt3], )
279
  end_btn.click(self._display_history, [], txt4)
280
  emptyBtn.click(self.clear_func,[],[])
281
  emptyBtn.click(lambda: None, None, chatbot, queue=False)
 
184
  message = response.choices[0].text.strip()
185
  if ":" in message:
186
  message = re.sub(r'^.*:', '', message)
187
+ return message.strip()
 
 
 
 
188
  except:
189
  return "How can I help you?"
190
 
191
 
 
192
  def _text_box(self,customer_emotion,customer_sentiment_score):
193
  sentiment_str = ', '.join([f'{label}: {score}' for label, score in zip(customer_sentiment_score['Sentiment'], customer_sentiment_score['Score'])])
194
  #emotion_str = ', '.join([f'{emotion}: {score}' for emotion, score in zip(customer_emotion['Emotion'], customer_emotion['Score'])])
 
269
 
270
  txt_msg = txt.submit(self._add_text, [chatbot, txt], [chatbot, txt])
271
  txt_msg.then(lambda: gr.update(interactive=True), None, [txt])
272
+ txt.submit(self._suggested_answer,txt,txt3)
273
+ button.click(self._agent_text, [chatbot,txt3], chatbot)
274
  end_btn.click(self._display_history, [], txt4)
275
  emptyBtn.click(self.clear_func,[],[])
276
  emptyBtn.click(lambda: None, None, chatbot, queue=False)