Spaces:
Sleeping
Sleeping
SammyGasana
commited on
Update main.py
Browse filesaccess update fr api
main.py
CHANGED
@@ -14,8 +14,15 @@ from audio_predictions import AudioTranslation
|
|
14 |
# Retrieve API key from .env file
|
15 |
# API_KEY = os.getenv('OPENAI_API_KEY')
|
16 |
|
|
|
|
|
17 |
API_KEY = os.getenv('OPENAI_API_KEY')
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
# Set the API key for OpenAI
|
20 |
# openai.api_key = API_KEY
|
21 |
dataset_path = 'updated_company_tweets.csv'
|
|
|
14 |
# Retrieve API key from .env file
|
15 |
# API_KEY = os.getenv('OPENAI_API_KEY')
|
16 |
|
17 |
+
|
18 |
+
|
19 |
API_KEY = os.getenv('OPENAI_API_KEY')
|
20 |
+
if API_KEY:
|
21 |
+
openai.api_key = API_KEY
|
22 |
+
else:
|
23 |
+
print("No API key provided. Please set the OPENAI_API_KEY environment variable.")
|
24 |
+
# Implement fallback behavior or exit gracefully
|
25 |
+
|
26 |
# Set the API key for OpenAI
|
27 |
# openai.api_key = API_KEY
|
28 |
dataset_path = 'updated_company_tweets.csv'
|