Commit
·
0718992
1
Parent(s):
4f9f1cf
Refactor code to remove OpenAI API key from source file
Browse files- playground/refs/test.ipynb +2 -2
- playground/refs/test.py +1 -1
- playground/testapp/main.py +1 -1
- playground/testapp/test.ipynb +0 -1
- playground/testapp/test.py +1 -1
playground/refs/test.ipynb
CHANGED
|
@@ -69,7 +69,7 @@
|
|
| 69 |
"whisper_model = whisperx.load_model(\"tiny\", device, compute_type=\"float16\")\n",
|
| 70 |
"logging.info('Loaded WhisperX model')\n",
|
| 71 |
"\n",
|
| 72 |
-
"openai.api_key = \"
|
| 73 |
"logging.info('Set OpenAI API key')\n",
|
| 74 |
"\n",
|
| 75 |
"# TTS Voice\n",
|
|
@@ -150,7 +150,7 @@
|
|
| 150 |
"source": [
|
| 151 |
"from openai import OpenAI\n",
|
| 152 |
"\n",
|
| 153 |
-
"openai_client = OpenAI(api_key='
|
| 154 |
"\n",
|
| 155 |
"def llm(text):\n",
|
| 156 |
" logging.info('Getting response from OpenAI API')\n",
|
|
|
|
| 69 |
"whisper_model = whisperx.load_model(\"tiny\", device, compute_type=\"float16\")\n",
|
| 70 |
"logging.info('Loaded WhisperX model')\n",
|
| 71 |
"\n",
|
| 72 |
+
"openai.api_key = \"\"\n",
|
| 73 |
"logging.info('Set OpenAI API key')\n",
|
| 74 |
"\n",
|
| 75 |
"# TTS Voice\n",
|
|
|
|
| 150 |
"source": [
|
| 151 |
"from openai import OpenAI\n",
|
| 152 |
"\n",
|
| 153 |
+
"openai_client = OpenAI(api_key='')\n",
|
| 154 |
"\n",
|
| 155 |
"def llm(text):\n",
|
| 156 |
" logging.info('Getting response from OpenAI API')\n",
|
playground/refs/test.py
CHANGED
|
@@ -27,7 +27,7 @@ logging.info('Loaded Silero VAD model')
|
|
| 27 |
whisper_model = whisperx.load_model("tiny", device, compute_type="float16")
|
| 28 |
logging.info('Loaded WhisperX model')
|
| 29 |
|
| 30 |
-
OPENAI_API_KEY = "
|
| 31 |
if not OPENAI_API_KEY:
|
| 32 |
logging.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 33 |
raise ValueError("OpenAI API key not found.")
|
|
|
|
| 27 |
whisper_model = whisperx.load_model("tiny", device, compute_type="float16")
|
| 28 |
logging.info('Loaded WhisperX model')
|
| 29 |
|
| 30 |
+
OPENAI_API_KEY = "" # os.getenv("OPENAI_API_KEY")
|
| 31 |
if not OPENAI_API_KEY:
|
| 32 |
logging.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 33 |
raise ValueError("OpenAI API key not found.")
|
playground/testapp/main.py
CHANGED
|
@@ -28,7 +28,7 @@ logging.info('Loaded Silero VAD model')
|
|
| 28 |
whisper_model = whisperx.load_model("tiny", device, compute_type="float16")
|
| 29 |
logging.info('Loaded WhisperX model')
|
| 30 |
|
| 31 |
-
OPENAI_API_KEY = "
|
| 32 |
if not OPENAI_API_KEY:
|
| 33 |
logging.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 34 |
raise ValueError("OpenAI API key not found.")
|
|
|
|
| 28 |
whisper_model = whisperx.load_model("tiny", device, compute_type="float16")
|
| 29 |
logging.info('Loaded WhisperX model')
|
| 30 |
|
| 31 |
+
OPENAI_API_KEY = ""
|
| 32 |
if not OPENAI_API_KEY:
|
| 33 |
logging.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 34 |
raise ValueError("OpenAI API key not found.")
|
playground/testapp/test.ipynb
CHANGED
|
@@ -36,7 +36,6 @@
|
|
| 36 |
"whisper_model = whisperx.load_model(\"tiny\", device, compute_type=\"float16\")\n",
|
| 37 |
"logging.info('Loaded WhisperX model')\n",
|
| 38 |
"\n",
|
| 39 |
-
"# OpenAI API Key from environment variable for security\n",
|
| 40 |
"OPENAI_API_KEY = \"\" # os.getenv(\"OPENAI_API_KEY\")\n",
|
| 41 |
"if not OPENAI_API_KEY:\n",
|
| 42 |
" logging.error(\"OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.\")\n",
|
|
|
|
| 36 |
"whisper_model = whisperx.load_model(\"tiny\", device, compute_type=\"float16\")\n",
|
| 37 |
"logging.info('Loaded WhisperX model')\n",
|
| 38 |
"\n",
|
|
|
|
| 39 |
"OPENAI_API_KEY = \"\" # os.getenv(\"OPENAI_API_KEY\")\n",
|
| 40 |
"if not OPENAI_API_KEY:\n",
|
| 41 |
" logging.error(\"OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.\")\n",
|
playground/testapp/test.py
CHANGED
|
@@ -31,7 +31,7 @@ logging.info('Loaded Silero VAD model')
|
|
| 31 |
whisper_model = whisperx.load_model("tiny", device, compute_type="float16")
|
| 32 |
logging.info('Loaded WhisperX model')
|
| 33 |
|
| 34 |
-
OPENAI_API_KEY = "
|
| 35 |
if not OPENAI_API_KEY:
|
| 36 |
logging.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 37 |
raise ValueError("OpenAI API key not found.")
|
|
|
|
| 31 |
whisper_model = whisperx.load_model("tiny", device, compute_type="float16")
|
| 32 |
logging.info('Loaded WhisperX model')
|
| 33 |
|
| 34 |
+
OPENAI_API_KEY = ""
|
| 35 |
if not OPENAI_API_KEY:
|
| 36 |
logging.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 37 |
raise ValueError("OpenAI API key not found.")
|