NavyDevilDoc commited on
Commit
2d32578
·
verified ·
1 Parent(s): 6492793

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -4,12 +4,17 @@ from google import genai
4
  from io import StringIO
5
  import prompts # Assuming prompts.py is in the same directory
6
 
7
- # Replace the st.secrets line with this:
8
  api_key = os.environ.get("GOOGLE_API_KEY")
9
 
10
  if not api_key:
11
- st.error("API Key not found. Please ensure GOOGLE_API_KEY is set in Hugging Face Secrets.")
12
- st.stop()
 
 
 
 
 
 
13
 
14
  st.set_page_config(page_title="SQL AI Assistant", layout="wide")
15
 
 
4
  from io import StringIO
5
  import prompts # Assuming prompts.py is in the same directory
6
 
 
7
  api_key = os.environ.get("GOOGLE_API_KEY")
8
 
9
  if not api_key:
10
+ # Fallback for local testing (if you have a local secrets.toml)
11
+ try:
12
+ api_key = st.secrets["GOOGLE_API_KEY"]
13
+ except:
14
+ st.error("Missing GOOGLE_API_KEY. Please add it to your Space Secrets.")
15
+ st.stop()
16
+
17
+ client = genai.Client(api_key=api_key)
18
 
19
  st.set_page_config(page_title="SQL AI Assistant", layout="wide")
20