Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -8,27 +8,18 @@ from transformers import pipeline
|
|
8 |
from langchain.llms import HuggingFacePipeline
|
9 |
|
10 |
|
11 |
-
# Instantiate chromadb instance. Data is stored on disk (a folder named 'my_vectordb' will be created in the same folder as this file).
|
12 |
-
chroma_client = chromadb.PersistentClient(path="vector_db")
|
13 |
|
14 |
-
|
15 |
-
|
|
|
16 |
sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-mpnet-base-v2")
|
17 |
|
18 |
-
# Use this to delete the database
|
19 |
-
# chroma_client.delete_collection(name="my_collection")
|
20 |
|
21 |
-
# Create the collection, aka vector database. Or, if database already exist, then use it. Specify the model that we want to use to do the embedding.
|
22 |
collection = chroma_client.get_or_create_collection(name="my_collection", embedding_function=sentence_transformer_ef)
|
23 |
|
24 |
-
# Add the data to the collection
|
25 |
-
# collection.add(
|
26 |
-
# documents=documents,
|
27 |
-
# metadatas=metadatas,
|
28 |
-
# ids=ids
|
29 |
-
# )
|
30 |
|
31 |
-
|
|
|
32 |
st.title("ChromaDB and HuggingFace Pipeline Integration")
|
33 |
|
34 |
query = st.text_input("Enter your query:", value="director")
|
|
|
8 |
from langchain.llms import HuggingFacePipeline
|
9 |
|
10 |
|
|
|
|
|
11 |
|
12 |
+
chroma_client = chromadb.PersistentClient(path="data_db")
|
13 |
+
|
14 |
+
|
15 |
sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-mpnet-base-v2")
|
16 |
|
|
|
|
|
17 |
|
|
|
18 |
collection = chroma_client.get_or_create_collection(name="my_collection", embedding_function=sentence_transformer_ef)
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
|
22 |
+
|
23 |
st.title("ChromaDB and HuggingFace Pipeline Integration")
|
24 |
|
25 |
query = st.text_input("Enter your query:", value="director")
|