bparekh99 commited on
Commit
465686b
·
verified ·
1 Parent(s): 0c9c3ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -2,12 +2,15 @@
2
 
3
  import gradio as gr
4
  import requests
5
-
6
- # Replace 'YOUR_GEMINI_API_KEY' with your actual Gemini API key.
7
- GEMINI_API_KEY = "AIzaSyB05WLxtH1x4fMvB87M-GggjQlBnm3YWeE"
8
 
9
  def optimize_resume_with_explanation(resume, job_description):
10
- # Updated Gemini API endpoint as requested
 
 
 
 
 
11
  url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent"
12
 
13
  # Prepare the prompt for the AI model
 
2
 
3
  import gradio as gr
4
  import requests
5
+ import os # Import os to access environment variables
 
 
6
 
7
  def optimize_resume_with_explanation(resume, job_description):
8
+ # Get the Gemini API key from Hugging Face secrets (environment variable)
9
+ GEMINI_API_KEY = os.environ.get("api_key")
10
+ if not GEMINI_API_KEY:
11
+ return "Error: Gemini API key not found in environment variables.", ""
12
+
13
+ # Gemini API endpoint
14
  url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent"
15
 
16
  # Prepare the prompt for the AI model