Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from streamlit_extras.add_vertical_space import add_vertical_space
|
|
5 |
from PyPDF2 import PdfReader
|
6 |
from openai.embeddings_utils import get_embedding
|
7 |
import openai
|
8 |
-
from dotenv import load_dotenv
|
9 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
10 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
11 |
from langchain.vectorstores import FAISS
|
@@ -27,15 +27,15 @@ with st.sidebar:
|
|
27 |
|
28 |
|
29 |
# Load environment variables
|
30 |
-
load_dotenv()
|
31 |
|
32 |
# # Retrieve OpenAI API key
|
33 |
-
openai_api_key = os.getenv("OPENAI_API_KEY")
|
34 |
-
if openai_api_key is None:
|
35 |
-
raise ValueError("The OPENAI_API_KEY environment variable is not set")
|
36 |
|
37 |
# # Set the OpenAI API key for the OpenAI library
|
38 |
-
openai.api_key = openai_api_key
|
39 |
|
40 |
def extract_text_from_pdf(pdf):
|
41 |
pdf_reader = PdfReader(pdf)
|
|
|
5 |
from PyPDF2 import PdfReader
|
6 |
from openai.embeddings_utils import get_embedding
|
7 |
import openai
|
8 |
+
#from dotenv import load_dotenv
|
9 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
10 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
11 |
from langchain.vectorstores import FAISS
|
|
|
27 |
|
28 |
|
29 |
# Load environment variables
|
30 |
+
#load_dotenv()
|
31 |
|
32 |
# # Retrieve OpenAI API key
|
33 |
+
#openai_api_key = os.getenv("OPENAI_API_KEY")
|
34 |
+
#if openai_api_key is None:
|
35 |
+
# raise ValueError("The OPENAI_API_KEY environment variable is not set")
|
36 |
|
37 |
# # Set the OpenAI API key for the OpenAI library
|
38 |
+
#openai.api_key = openai_api_key
|
39 |
|
40 |
def extract_text_from_pdf(pdf):
|
41 |
pdf_reader = PdfReader(pdf)
|