Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,14 +3,17 @@ import os
|
|
3 |
import openai
|
4 |
from dotenv import load_dotenv
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
#echo openai_api_key="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" > .env
|
7 |
-
openai_api_key="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"
|
8 |
-
"""
|
9 |
-
# Write the environment variable to a file named .env
|
10 |
-
openai_api_key = openai_api_key > .env
|
11 |
|
12 |
load_dotenv(".env")
|
13 |
-
|
14 |
openai.api_key = os.environ.get("openai_api_key")
|
15 |
|
16 |
os.environ["OPENAI_API_KEY"] = openai.api_key
|
|
|
3 |
import openai
|
4 |
from dotenv import load_dotenv
|
5 |
|
6 |
+
|
7 |
+
API_KEY = "k-3irlTPJi5IPkPkjheHfrT3BlbkFJf9ACVS3pHhacqjisnLWy"
|
8 |
+
|
9 |
+
# Write the API key to the .env file
|
10 |
+
with open(".env", "w") as env_file:
|
11 |
+
env_file.write(f"openai_api_key={API_KEY}\n")
|
12 |
+
|
13 |
#echo openai_api_key="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" > .env
|
|
|
|
|
|
|
|
|
14 |
|
15 |
load_dotenv(".env")
|
16 |
+
|
17 |
openai.api_key = os.environ.get("openai_api_key")
|
18 |
|
19 |
os.environ["OPENAI_API_KEY"] = openai.api_key
|