Mehrdad Javadi
commited on
Commit
•
ab30fbb
1
Parent(s):
8961b48
Update utils.py
Browse files
utils.py
CHANGED
@@ -3,11 +3,20 @@ from langchain.llms import OpenAI
|
|
3 |
from langchain.agents import initialize_agent
|
4 |
from langchain.agents.agent_toolkits import ZapierToolkit
|
5 |
from langchain.utilities.zapier import ZapierNLAWrapper
|
|
|
6 |
import os
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
def transcribe_audio(uploaded_file):
|
13 |
# Load Whisper model
|
|
|
3 |
from langchain.agents import initialize_agent
|
4 |
from langchain.agents.agent_toolkits import ZapierToolkit
|
5 |
from langchain.utilities.zapier import ZapierNLAWrapper
|
6 |
+
from dotenv import load_dotenv
|
7 |
import os
|
8 |
|
9 |
+
|
10 |
+
# Load environment variables from .env file
|
11 |
+
load_dotenv()
|
12 |
+
|
13 |
+
# Retrieve API keys from environment variables
|
14 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
15 |
+
ZAPIER_NLA_API_KEY = os.getenv("ZAPIER_NLA_API_KEY")
|
16 |
+
|
17 |
+
# Check if API keys are present
|
18 |
+
if OPENAI_API_KEY is None or ZAPIER_NLA_API_KEY is None:
|
19 |
+
raise ValueError("One or both API keys are missing. Please make sure they are set in the environment.")
|
20 |
|
21 |
def transcribe_audio(uploaded_file):
|
22 |
# Load Whisper model
|