Adarsh-aot commited on
Commit
59cb95a
·
verified ·
1 Parent(s): 07ae696

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -14
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
- # Select the embedding model to use.
15
- # List of model names can be found here https://www.sbert.net/docs/pretrained_models.html
 
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
- # Streamlit app layout
 
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")