dnzblgn commited on
Commit
9d8f95d
·
verified ·
1 Parent(s): dad7666

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -8,6 +8,7 @@ from langchain_community.embeddings import HuggingFaceEmbeddings
8
  from langchain.memory import ConversationBufferMemory
9
  from langchain_community.llms import HuggingFaceEndpoint
10
  import os
 
11
 
12
  # Load models and tokenizers
13
  sentiment_tokenizer = AutoTokenizer.from_pretrained("dnzblgn/Sentiment-Analysis-Customer-Reviews")
@@ -165,6 +166,7 @@ def user_query_typing_effect(query, qa_chain, chatbot):
165
  for i in range(len(assistant_response)):
166
  history[-1]["content"] += assistant_response[i]
167
  yield history, ""
 
168
  except Exception as e:
169
  history.append({"role": "assistant", "content": f"Error: {str(e)}"})
170
  yield history, ""
@@ -254,3 +256,4 @@ def demo():
254
 
255
  if __name__ == "__main__":
256
  demo()
 
 
8
  from langchain.memory import ConversationBufferMemory
9
  from langchain_community.llms import HuggingFaceEndpoint
10
  import os
11
+ import time
12
 
13
  # Load models and tokenizers
14
  sentiment_tokenizer = AutoTokenizer.from_pretrained("dnzblgn/Sentiment-Analysis-Customer-Reviews")
 
166
  for i in range(len(assistant_response)):
167
  history[-1]["content"] += assistant_response[i]
168
  yield history, ""
169
+ time.sleep(0.05) # Slower typing effect
170
  except Exception as e:
171
  history.append({"role": "assistant", "content": f"Error: {str(e)}"})
172
  yield history, ""
 
256
 
257
  if __name__ == "__main__":
258
  demo()
259
+