typesdigital commited on
Commit
22c6fbc
·
verified ·
1 Parent(s): a517e71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -5,7 +5,12 @@ import google.generativeai as genai
5
  from PIL import Image
6
 
7
  # Configure the Gemini API
8
- genai.configure(api_key=os.environ["AIzaSyCFdxcKVO6VSxEBaNE2W3LIvRLPEPpyMGw"])
 
 
 
 
 
9
 
10
  def upload_to_gemini(image):
11
  """Uploads the given image to Gemini."""
 
5
  from PIL import Image
6
 
7
  # Configure the Gemini API
8
+ # Retrieve the API key from Hugging Face Spaces secrets
9
+ api_key = os.environ.get("GEMINI_API_KEY")
10
+ if not api_key:
11
+ raise ValueError("GEMINI_API_KEY not found in environment variables. Please set it in Hugging Face Spaces secrets.")
12
+
13
+ genai.configure(api_key=api_key)
14
 
15
  def upload_to_gemini(image):
16
  """Uploads the given image to Gemini."""