Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|