Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -44,21 +44,20 @@ def get_text_chunks(text):
|
|
44 |
return []
|
45 |
return chunks
|
46 |
|
47 |
-
# Function to create an in-memory FAISS vector store
|
48 |
# Function to create an in-memory FAISS vector store
|
49 |
def get_vector_store(text_chunks):
|
50 |
try:
|
51 |
-
# Create an instance of HuggingFaceEmbeddings
|
52 |
embedding_function = HuggingFaceEmbeddings(model_name="jinaai/jina-embeddings-v2-base-code")
|
53 |
|
54 |
-
# Using FAISS to create vector store with the embeddings
|
55 |
vector_store = FAISS.from_texts(text_chunks, embedding=embedding_function)
|
|
|
56 |
return vector_store
|
57 |
except Exception as e:
|
58 |
st.error(f"Error creating vector store: {e}")
|
59 |
traceback.print_exc()
|
60 |
return None
|
61 |
-
|
62 |
# Function to create a conversation chain with Google Generative AI
|
63 |
def get_conversational_chain():
|
64 |
try:
|
|
|
44 |
return []
|
45 |
return chunks
|
46 |
|
|
|
47 |
# Function to create an in-memory FAISS vector store
|
48 |
def get_vector_store(text_chunks):
|
49 |
try:
|
50 |
+
# Create an instance of HuggingFaceEmbeddings
|
51 |
embedding_function = HuggingFaceEmbeddings(model_name="jinaai/jina-embeddings-v2-base-code")
|
52 |
|
53 |
+
# Using FAISS to create vector store with the embeddings class instance
|
54 |
vector_store = FAISS.from_texts(text_chunks, embedding=embedding_function)
|
55 |
+
|
56 |
return vector_store
|
57 |
except Exception as e:
|
58 |
st.error(f"Error creating vector store: {e}")
|
59 |
traceback.print_exc()
|
60 |
return None
|
|
|
61 |
# Function to create a conversation chain with Google Generative AI
|
62 |
def get_conversational_chain():
|
63 |
try:
|