Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,17 @@ from io import BytesIO
|
|
9 |
import tempfile
|
10 |
|
11 |
# --- Google Gemini API Configuration ---
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
client = genai.Client(
|
17 |
-
api_key=
|
18 |
)
|
19 |
|
20 |
GEMINI_MODEL_NAME = 'gemini-2.5-flash-image-preview'
|
@@ -237,14 +242,14 @@ button.selected {
|
|
237 |
}
|
238 |
|
239 |
/* Examples Styling */
|
240 |
-
.examples
|
241 |
background: #f9fafb;
|
242 |
border-radius: 0.5rem;
|
243 |
padding: 1rem;
|
244 |
margin-top: 1rem;
|
245 |
}
|
246 |
|
247 |
-
.dark .examples
|
248 |
background: #1f2937;
|
249 |
}
|
250 |
|
@@ -377,8 +382,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
|
377 |
["λ΄λ λ²κ½μ΄ λ§κ°ν μΌλ³Έ μ μ"],
|
378 |
["ννμ§ μΈκ³μ λ§λ²μ¬ ν"],
|
379 |
],
|
380 |
-
inputs=prompt_input
|
381 |
-
elem_classes="examples-container"
|
382 |
)
|
383 |
|
384 |
gr.HTML('</div>')
|
|
|
9 |
import tempfile
|
10 |
|
11 |
# --- Google Gemini API Configuration ---
|
12 |
+
# Use GEMINI_API_KEY if available, otherwise fall back to GOOGLE_API_KEY
|
13 |
+
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
14 |
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
15 |
+
|
16 |
+
API_KEY = GEMINI_API_KEY or GOOGLE_API_KEY
|
17 |
+
|
18 |
+
if not API_KEY:
|
19 |
+
raise ValueError("Neither GEMINI_API_KEY nor GOOGLE_API_KEY environment variable is set.")
|
20 |
|
21 |
client = genai.Client(
|
22 |
+
api_key=API_KEY,
|
23 |
)
|
24 |
|
25 |
GEMINI_MODEL_NAME = 'gemini-2.5-flash-image-preview'
|
|
|
242 |
}
|
243 |
|
244 |
/* Examples Styling */
|
245 |
+
.examples {
|
246 |
background: #f9fafb;
|
247 |
border-radius: 0.5rem;
|
248 |
padding: 1rem;
|
249 |
margin-top: 1rem;
|
250 |
}
|
251 |
|
252 |
+
.dark .examples {
|
253 |
background: #1f2937;
|
254 |
}
|
255 |
|
|
|
382 |
["λ΄λ λ²κ½μ΄ λ§κ°ν μΌλ³Έ μ μ"],
|
383 |
["ννμ§ μΈκ³μ λ§λ²μ¬ ν"],
|
384 |
],
|
385 |
+
inputs=prompt_input
|
|
|
386 |
)
|
387 |
|
388 |
gr.HTML('</div>')
|