Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,12 @@ import google.generativeai as genai
|
|
5 |
from PIL import Image
|
6 |
|
7 |
# Configure the Gemini API
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
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."""
|