Spaces:
Build error
Build error
PK commited on
Update streamlit_app.py
Browse files- streamlit_app.py +7 -1
streamlit_app.py
CHANGED
|
@@ -58,7 +58,13 @@ def _remove_all_videos():
|
|
| 58 |
print("Couldn't delete file:", video)
|
| 59 |
|
| 60 |
expander = st.sidebar.expander("Options", expanded=True)
|
| 61 |
-
#API
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
API_KEY = expander.text_input("Google API Key", "AIzaSyDBGF5y7WqDB0SO7-UO6yjshiEZN3Hpt3g")
|
| 63 |
if API_KEY:
|
| 64 |
genai.configure(api_key=API_KEY)
|
|
|
|
| 58 |
print("Couldn't delete file:", video)
|
| 59 |
|
| 60 |
expander = st.sidebar.expander("Options", expanded=True)
|
| 61 |
+
# ✅ Load API key securely
|
| 62 |
+
API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 63 |
+
# ✅ Check if API key is available
|
| 64 |
+
if not api_key:
|
| 65 |
+
st.error("⚠️ API key is missing! Set GOOGLE_API_KEY as an environment variable")
|
| 66 |
+
st.stop()
|
| 67 |
+
# ✅ Configure Gemini API
|
| 68 |
API_KEY = expander.text_input("Google API Key", "AIzaSyDBGF5y7WqDB0SO7-UO6yjshiEZN3Hpt3g")
|
| 69 |
if API_KEY:
|
| 70 |
genai.configure(api_key=API_KEY)
|