aiqtech commited on
Commit
0413cb0
Β·
verified Β·
1 Parent(s): a3f8f8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -9,12 +9,17 @@ from io import BytesIO
9
  import tempfile
10
 
11
  # --- Google Gemini API Configuration ---
12
- GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY", "")
13
- if not GOOGLE_API_KEY:
14
- raise ValueError("GOOGLE_API_KEY environment variable not set.")
 
 
 
 
 
15
 
16
  client = genai.Client(
17
- api_key=os.environ.get("GEMINI_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-container {
241
  background: #f9fafb;
242
  border-radius: 0.5rem;
243
  padding: 1rem;
244
  margin-top: 1rem;
245
  }
246
 
247
- .dark .examples-container {
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>')