Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,19 @@ from langchain_community.vectorstores import FAISS
|
|
15 |
load_dotenv()
|
16 |
|
17 |
# Securely retrieve the OpenAI API key
|
18 |
-
openai_api_key = os.getenv("
|
|
|
|
|
|
|
|
|
|
|
19 |
if not openai_api_key:
|
20 |
raise ValueError("Missing OpenAI API key. Set OPENAI_API_KEY in your environment variables.")
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Initialize FastAPI app
|
23 |
app = FastAPI()
|
|
|
15 |
load_dotenv()
|
16 |
|
17 |
# Securely retrieve the OpenAI API key
|
18 |
+
openai_api_key = os.getenv("OPENAI_API_KEY")
|
19 |
+
import os
|
20 |
+
|
21 |
+
# Securely retrieve the OpenAI API key from the environment variable
|
22 |
+
openai_api_key = os.getenv("OPENAI_API_KEY")
|
23 |
+
|
24 |
if not openai_api_key:
|
25 |
raise ValueError("Missing OpenAI API key. Set OPENAI_API_KEY in your environment variables.")
|
26 |
+
openai_api_key = os.getenv("OPENAI_API_KEY")
|
27 |
+
if openai_api_key:
|
28 |
+
print("API Key loaded successfully!")
|
29 |
+
else:
|
30 |
+
print("API Key not found.")
|
31 |
|
32 |
# Initialize FastAPI app
|
33 |
app = FastAPI()
|