nklomp commited on
Commit
e9d633c
1 Parent(s): bac3a5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -49,11 +49,7 @@ def get_vectorstore(text_chunks,selected_embedding):
49
 
50
  embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
51
  elif selected_embedding == 'Cohere-multilingual-v3.0':
52
-
53
- embeddings = CohereEmbeddings(
54
- model="embed-multilingual-v3.0",
55
- cohere_api_key=os.environ.get("COHERE_API_KEY")
56
- )
57
 
58
  vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
59
  vectorstore.save_local("faiss_index")
@@ -67,11 +63,7 @@ def load_vectorstore(text_chunks,selected_embedding):
67
  embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
68
  vectorstore = FAISS.load_local("faiss_index", embeddings)
69
  elif selected_embedding == 'Cohere-multilingual-v3.0':
70
-
71
- embeddings = CohereEmbeddings(
72
- model="embed-multilingual-v3.0",
73
- cohere_api_key=os.environ.get("COHERE_API_KEY")
74
- )
75
 
76
  vectorstore = FAISS.load_local("faiss_index", embeddings)
77
  return vectorstore
@@ -173,7 +165,8 @@ def get_conversation_chain(vectorstore,selected_llm,selected_temperature):
173
  def handle_userinput(user_question):
174
 
175
  #print('Question: ' + user_question)
176
- response = st.session_state.conversation({'question': user_question})
 
177
 
178
  anser = response.get("answer")
179
  sources = response.get("source_documents", [])
 
49
 
50
  embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
51
  elif selected_embedding == 'Cohere-multilingual-v3.0':
52
+ embeddings = CohereEmbeddings(model="embed-multilingual-v3.0")
 
 
 
 
53
 
54
  vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
55
  vectorstore.save_local("faiss_index")
 
63
  embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
64
  vectorstore = FAISS.load_local("faiss_index", embeddings)
65
  elif selected_embedding == 'Cohere-multilingual-v3.0':
66
+ embeddings = CohereEmbeddings(model="embed-multilingual-v3.0")
 
 
 
 
67
 
68
  vectorstore = FAISS.load_local("faiss_index", embeddings)
69
  return vectorstore
 
165
  def handle_userinput(user_question):
166
 
167
  #print('Question: ' + user_question)
168
+ response = st.session_state.conversation.invoke({'question': user_question})
169
+
170
 
171
  anser = response.get("answer")
172
  sources = response.get("source_documents", [])