admin08077 commited on
Commit
af85b92
·
verified ·
1 Parent(s): b36b27d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -16
app.py CHANGED
@@ -12,23 +12,12 @@ import uuid
12
  import concurrent.futures
13
  import re
14
 
15
- # --- Configuration and Initialization ---
16
-
17
- # Configure the Gemini API client. It will automatically pick up the
18
- # GEMINI_API_KEY from the environment variables.
19
- # Make sure to set this secret in your Hugging Face Space.
20
- try:
21
- client = genai.Client()
22
- # A quick check to see if the client is configured.
23
- # This will throw an exception if the key is not found.
24
- client.get_api_key()
25
- except Exception as e:
26
- raise ValueError(
27
- "Could not configure Gemini API client. "
28
- "Please make sure the GEMINI_API_KEY secret is set in your Hugging Face Space. "
29
- f"Original error: {e}"
30
- )
31
 
 
 
32
 
33
  # --- Default Data Structures (Ported from TypeScript) ---
34
 
 
12
  import concurrent.futures
13
  import re
14
 
15
+ GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
16
+ if not GEMINI_API_KEY:
17
+ raise ValueError("GEMINI_API_KEY not found in environment variables.")
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ # Initialize Gemini client
20
+ client = genai.Client(api_key=GEMINI_API_KEY)
21
 
22
  # --- Default Data Structures (Ported from TypeScript) ---
23