Spaces:
Runtime error
Runtime error
Commit ·
52e5a28
1
Parent(s): e56aa0d
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,8 @@ from langchain.vectorstores import FAISS
|
|
| 15 |
from streamlit_chat import message
|
| 16 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
|
| 17 |
import torch
|
| 18 |
-
|
|
|
|
| 19 |
st.set_page_config(layout="wide")
|
| 20 |
|
| 21 |
|
|
@@ -47,8 +48,7 @@ def data_ingestion():
|
|
| 47 |
|
| 48 |
# create embeddings of the chunked document
|
| 49 |
#embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
| 50 |
-
|
| 51 |
-
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 52 |
embeddings = OpenAIEmbeddings()
|
| 53 |
vectordb = FAISS.from_documents(splits, embeddings)
|
| 54 |
vectordb.save_local("faiss_index")
|
|
|
|
| 15 |
from streamlit_chat import message
|
| 16 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
|
| 17 |
import torch
|
| 18 |
+
load_dotenv()
|
| 19 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 20 |
st.set_page_config(layout="wide")
|
| 21 |
|
| 22 |
|
|
|
|
| 48 |
|
| 49 |
# create embeddings of the chunked document
|
| 50 |
#embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
| 51 |
+
|
|
|
|
| 52 |
embeddings = OpenAIEmbeddings()
|
| 53 |
vectordb = FAISS.from_documents(splits, embeddings)
|
| 54 |
vectordb.save_local("faiss_index")
|