DreamStream-1 commited on
Commit
917698d
·
verified ·
1 Parent(s): 822ac82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -12,9 +12,11 @@ model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
12
  # Define maximum number of resumes
13
  MAX_RESUMES = 10
14
 
15
- # Function to fetch Google API key from Hugging Face Secrets
16
  def get_google_api_key():
17
- api_key = gr.secret('GOOGLE_API_KEY') # Fetching the API key from Hugging Face secrets
 
 
18
  return api_key
19
 
20
  # Function to extract text from resume (handles .txt, .pdf, .docx)
@@ -60,7 +62,7 @@ def extract_leadership_experience(resume_text):
60
 
61
  # System prompt to extract candidate details using Gemini API
62
  def extract_entities_via_gemini(resume_text):
63
- api_key = get_google_api_key() # Fetch the API key from Hugging Face secrets
64
  endpoint = "https://gemini.googleapis.com/v1/documents:analyzeEntities" # Placeholder API endpoint (adjust as necessary)
65
 
66
  headers = {
 
12
  # Define maximum number of resumes
13
  MAX_RESUMES = 10
14
 
15
+ # Function to fetch Google API key from environment variable
16
  def get_google_api_key():
17
+ api_key = os.getenv('GOOGLE_API_KEY') # Fetching the API key from environment variables
18
+ if not api_key:
19
+ raise ValueError("Google API key not found in environment variables.")
20
  return api_key
21
 
22
  # Function to extract text from resume (handles .txt, .pdf, .docx)
 
62
 
63
  # System prompt to extract candidate details using Gemini API
64
  def extract_entities_via_gemini(resume_text):
65
+ api_key = get_google_api_key() # Fetch the API key from environment variables
66
  endpoint = "https://gemini.googleapis.com/v1/documents:analyzeEntities" # Placeholder API endpoint (adjust as necessary)
67
 
68
  headers = {