Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -89,6 +89,7 @@ from langchain.vectorstores import Chroma
|
|
89 |
import gradio as gr
|
90 |
from transformers import pipeline
|
91 |
from sentence_transformers import SentenceTransformer
|
|
|
92 |
|
93 |
__import__('pysqlite3')
|
94 |
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
|
@@ -115,7 +116,7 @@ docs = splitter.split_documents(docs)
|
|
115 |
# Extract the content from documents and create embeddings
|
116 |
embedding_model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
|
117 |
texts = [doc.page_content for doc in docs]
|
118 |
-
embeddings = embedding_model.encode(texts)
|
119 |
|
120 |
# Create a Chroma vector store and add documents and their embeddings
|
121 |
vectorstore = Chroma(persist_directory="./data")
|
@@ -175,3 +176,4 @@ demo.launch(debug=True)
|
|
175 |
|
176 |
|
177 |
|
|
|
|
89 |
import gradio as gr
|
90 |
from transformers import pipeline
|
91 |
from sentence_transformers import SentenceTransformer
|
92 |
+
import numpy as np
|
93 |
|
94 |
__import__('pysqlite3')
|
95 |
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
|
|
|
116 |
# Extract the content from documents and create embeddings
|
117 |
embedding_model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
|
118 |
texts = [doc.page_content for doc in docs]
|
119 |
+
embeddings = embedding_model.encode(texts).tolist() # Convert numpy arrays to lists
|
120 |
|
121 |
# Create a Chroma vector store and add documents and their embeddings
|
122 |
vectorstore = Chroma(persist_directory="./data")
|
|
|
176 |
|
177 |
|
178 |
|
179 |
+
|