muhammadshaheryar commited on
Commit
0bd57b1
·
verified ·
1 Parent(s): b67a313

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
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")