Spaces:
Runtime error
Runtime error
Shroogawh24
commited on
Commit
•
49027f3
1
Parent(s):
a143f6b
Update app.py
Browse files
app.py
CHANGED
@@ -8,20 +8,20 @@ from langchain.chains import LLMChain
|
|
8 |
from langchain_core.output_parsers.string import StrOutputParser
|
9 |
from langchain.chat_models import ChatOpenAI
|
10 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
11 |
-
from langchain.embeddings import HuggingFaceBgeEmbeddings
|
12 |
|
13 |
from sentence_transformers import SentenceTransformer
|
14 |
|
15 |
#embeddings = OpenAIEmbeddings()
|
16 |
-
model_name = "BAAI/bge-large-en-v1.5"
|
17 |
-
model_kwargs = {'device':'cuda'}
|
18 |
-
encode_kwargs = {'normalize_embeddings':True}
|
19 |
-
|
20 |
-
embedding_function = HuggingFaceBgeEmbeddings(
|
21 |
-
model_name = model_name,
|
22 |
-
model_kwargs = model_kwargs,
|
23 |
-
encode_kwargs = encode_kwargs
|
24 |
-
)
|
25 |
|
26 |
embedder = SentenceTransformer('all-mpnet-base-v2')
|
27 |
|
@@ -29,7 +29,7 @@ embedder = SentenceTransformer('all-mpnet-base-v2')
|
|
29 |
#openai.api_key = os.getenv("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")
|
30 |
|
31 |
# Load the FAISS index using LangChain's FAISS implementation
|
32 |
-
db = FAISS.load_local("Faiss_index",
|
33 |
parser = StrOutputParser()
|
34 |
|
35 |
# Load your data (e.g., a DataFrame)
|
|
|
8 |
from langchain_core.output_parsers.string import StrOutputParser
|
9 |
from langchain.chat_models import ChatOpenAI
|
10 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
11 |
+
#from langchain.embeddings import HuggingFaceBgeEmbeddings
|
12 |
|
13 |
from sentence_transformers import SentenceTransformer
|
14 |
|
15 |
#embeddings = OpenAIEmbeddings()
|
16 |
+
#model_name = "BAAI/bge-large-en-v1.5"
|
17 |
+
#model_kwargs = {'device':'cuda'}
|
18 |
+
#encode_kwargs = {'normalize_embeddings':True}
|
19 |
+
|
20 |
+
#embedding_function = HuggingFaceBgeEmbeddings(
|
21 |
+
# model_name = model_name,
|
22 |
+
# model_kwargs = model_kwargs,
|
23 |
+
# encode_kwargs = encode_kwargs
|
24 |
+
#)
|
25 |
|
26 |
embedder = SentenceTransformer('all-mpnet-base-v2')
|
27 |
|
|
|
29 |
#openai.api_key = os.getenv("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")
|
30 |
|
31 |
# Load the FAISS index using LangChain's FAISS implementation
|
32 |
+
db = FAISS.load_local("Faiss_index", embedder, allow_dangerous_deserialization=True)
|
33 |
parser = StrOutputParser()
|
34 |
|
35 |
# Load your data (e.g., a DataFrame)
|