Spaces:
Sleeping
Sleeping
Commit
•
6692be6
1
Parent(s):
8dd99a4
[WIP]
Browse files- SearchEngine.py +3 -8
SearchEngine.py
CHANGED
@@ -3,14 +3,9 @@ from chromadb.config import Settings
|
|
3 |
import chromadb
|
4 |
|
5 |
class searchengine:
|
6 |
-
|
|
|
7 |
|
8 |
-
def __new__(cls, model_name, collection_name):
|
9 |
-
if cls.instance is None:
|
10 |
-
cls.instance = super(searchengine, cls).__new__(cls)
|
11 |
-
return cls.instance
|
12 |
-
else:
|
13 |
-
return cls.instance
|
14 |
def __init__(self, model_name,collection_name):
|
15 |
|
16 |
self.sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(
|
@@ -19,7 +14,7 @@ class searchengine:
|
|
19 |
self.chroma_client = chromadb.Client(
|
20 |
)
|
21 |
self.collection = self.chroma_client.get_or_create_collection(name=collection_name)
|
22 |
-
|
23 |
|
24 |
def add(self, text , metadata,id):
|
25 |
self.collection.add(
|
|
|
3 |
import chromadb
|
4 |
|
5 |
class searchengine:
|
6 |
+
|
7 |
+
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
def __init__(self, model_name,collection_name):
|
10 |
|
11 |
self.sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(
|
|
|
14 |
self.chroma_client = chromadb.Client(
|
15 |
)
|
16 |
self.collection = self.chroma_client.get_or_create_collection(name=collection_name)
|
17 |
+
|
18 |
|
19 |
def add(self, text , metadata,id):
|
20 |
self.collection.add(
|