bsiddhharth commited on
Commit
45fe6a4
·
1 Parent(s): f59e5ea

added try except to groq_api_key

Browse files
cv_analyzer_search.py CHANGED
@@ -18,6 +18,12 @@ def make_clickable_link(link):
18
 
19
  # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
20
  groq_api_key = os.getenv("GROQ_API_KEY")
 
 
 
 
 
 
21
 
22
  # groq_api_key = st.secrets["GROQ_API_KEY"]
23
 
 
18
 
19
  # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
20
  groq_api_key = os.getenv("GROQ_API_KEY")
21
+ if groq_api_key is None:
22
+ try:
23
+ groq_api_key = st.secrets["GROQ_API_KEY"]
24
+ except Exception as e:
25
+ st.error("GROQ_API_KEY is not set in the environment variables or Streamlit secrets.")
26
+ groq_api_key = None
27
 
28
  # groq_api_key = st.secrets["GROQ_API_KEY"]
29
 
cv_question.py CHANGED
@@ -7,7 +7,7 @@ import json
7
  from extraction import extract_cv_data, process_file, display_candidates_info # importing from your extraction.py
8
 
9
  # Initialize environment variables
10
- os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
11
  groq_api_key = os.getenv("GROQ_API_KEY")
12
 
13
  class InterviewQuestionGenerator:
 
7
  from extraction import extract_cv_data, process_file, display_candidates_info # importing from your extraction.py
8
 
9
  # Initialize environment variables
10
+ # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
11
  groq_api_key = os.getenv("GROQ_API_KEY")
12
 
13
  class InterviewQuestionGenerator:
extraction.py CHANGED
@@ -55,7 +55,12 @@ def initialize_llm() -> ChatGroq:
55
 
56
  # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
57
  groq_api_key = os.getenv("GROQ_API_KEY")
58
-
 
 
 
 
 
59
  # groq_api_key = st.secrets["GROQ_API_KEY"]
60
 
61
 
 
55
 
56
  # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
57
  groq_api_key = os.getenv("GROQ_API_KEY")
58
+ if groq_api_key is None:
59
+ try:
60
+ groq_api_key = st.secrets["GROQ_API_KEY"]
61
+ except Exception as e:
62
+ st.error("GROQ_API_KEY is not set in the environment variables or Streamlit secrets.")
63
+ groq_api_key = None
64
  # groq_api_key = st.secrets["GROQ_API_KEY"]
65
 
66
 
resume_advance_analysis.py CHANGED
@@ -12,7 +12,12 @@ import logging
12
 
13
  # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
14
  groq_api_key = os.getenv("GROQ_API_KEY")
15
-
 
 
 
 
 
16
  # groq_api_key = st.secrets["GROQ_API_KEY"]
17
 
18
  class ResumeImprovementEngine:
 
12
 
13
  # os.environ['GROQ_API_KEY'] = os.getenv("GROQ_API_KEY")
14
  groq_api_key = os.getenv("GROQ_API_KEY")
15
+ if groq_api_key is None:
16
+ try:
17
+ groq_api_key = st.secrets["GROQ_API_KEY"]
18
+ except Exception as e:
19
+ st.error("GROQ_API_KEY is not set in the environment variables or Streamlit secrets.")
20
+ groq_api_key = None
21
  # groq_api_key = st.secrets["GROQ_API_KEY"]
22
 
23
  class ResumeImprovementEngine: