Spaces:
Runtime error
Runtime error
saaketvarma
commited on
Commit
•
3cd1b56
1
Parent(s):
cb6f970
Update app.py
Browse files
app.py
CHANGED
@@ -43,23 +43,9 @@ def data_ingestion():
|
|
43 |
splits = text_splitter.split_documents(documents)
|
44 |
|
45 |
# create embeddings here
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
embeddings = []
|
51 |
-
for split in splits:
|
52 |
-
completion = openai.Completion.create(
|
53 |
-
model=model,
|
54 |
-
prompt=split,
|
55 |
-
temperature=0.7,
|
56 |
-
max_tokens=100,
|
57 |
-
)
|
58 |
-
|
59 |
-
embedding = completion.choices[0].embedding
|
60 |
-
embeddings.append(embedding)
|
61 |
-
vectordb = FAISS.from_documents(splits, embeddings)
|
62 |
-
vectordb.save_local("faiss_index")
|
63 |
|
64 |
|
65 |
@st.cache_resource
|
|
|
43 |
splits = text_splitter.split_documents(documents)
|
44 |
|
45 |
# create embeddings here
|
46 |
+
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
47 |
+
vectordb = FAISS.from_documents(splits, embeddings)
|
48 |
+
vectordb.save_local("faiss_index")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
|
51 |
@st.cache_resource
|