Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,15 @@ from langchain.embeddings import SentenceTransformerEmbeddings
|
|
9 |
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
10 |
embeddings = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Initialize embedding model
|
14 |
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
|
|
9 |
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
10 |
embeddings = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
|
11 |
|
12 |
+
import subprocess
|
13 |
+
import sys
|
14 |
+
|
15 |
+
# Install sentence-transformers if not installed
|
16 |
+
try:
|
17 |
+
import sentence_transformers
|
18 |
+
except ImportError:
|
19 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "sentence-transformers"])
|
20 |
+
|
21 |
|
22 |
# Initialize embedding model
|
23 |
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|