Spaces:
Running
Running
updates
Browse files- utils.py +0 -2
- webchat.py +14 -2
utils.py
CHANGED
@@ -20,8 +20,6 @@ def create_collection_name(url):
|
|
20 |
else:
|
21 |
return "base"
|
22 |
|
23 |
-
|
24 |
-
|
25 |
def clear_collection(collection_name):
|
26 |
client = chromadb.Client()
|
27 |
try:
|
|
|
20 |
else:
|
21 |
return "base"
|
22 |
|
|
|
|
|
23 |
def clear_collection(collection_name):
|
24 |
client = chromadb.Client()
|
25 |
try:
|
webchat.py
CHANGED
@@ -79,8 +79,20 @@ def get_model_test(model_type, max_tokens, min_tokens, decoding, temperature):
|
|
79 |
|
80 |
return model
|
81 |
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
# Embedding function
|
85 |
class MiniLML6V2EmbeddingFunction(EmbeddingFunction):
|
86 |
MODEL = model
|
|
|
79 |
|
80 |
return model
|
81 |
|
82 |
+
|
83 |
+
|
84 |
+
# Set up cache directory (consider user-defined location)
|
85 |
+
current_dir = os.getcwd()
|
86 |
+
cache_dir = os.path.join(current_dir, ".cache")
|
87 |
+
# Create cache directory if necessary
|
88 |
+
if not os.path.exists(cache_dir):
|
89 |
+
os.makedirs(cache_dir)
|
90 |
+
# Download the model (specify the correct model identifier)
|
91 |
+
#model_name = 'sentence-transformers/all-MiniLM-L6-v2'
|
92 |
+
model_name = "all-MiniLM-L6-v2"
|
93 |
+
model = SentenceTransformer(model_name, cache_folder=cache_dir)
|
94 |
+
# Print confirmation message
|
95 |
+
print(f"Model '{model_name}' downloaded and loaded from cache directory: {cache_dir}")
|
96 |
# Embedding function
|
97 |
class MiniLML6V2EmbeddingFunction(EmbeddingFunction):
|
98 |
MODEL = model
|