Karley8 commited on
Commit
a3f34a3
·
verified ·
1 Parent(s): c9b2704

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -2,8 +2,14 @@ import streamlit as st
2
  import google.generativeai as genai
3
  import os
4
 
5
- # Set up the API key
6
- GOOGLE_API_KEY = "AIzaSyCtMlmoCp9fcfsKJ_ZglZEL6cD5fb8FU-Y" # Replace with your API key
 
 
 
 
 
 
7
  genai.configure(api_key=GOOGLE_API_KEY)
8
 
9
  # Function to get a sarcastic response from Gemini
 
2
  import google.generativeai as genai
3
  import os
4
 
5
+ # Load API key from environment variables
6
+ GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
7
+
8
+ if not GOOGLE_API_KEY:
9
+ st.error("⚠️ API key is missing. Please set it in the Hugging Face Space secrets.")
10
+ st.stop()
11
+
12
+ # Configure Gemini API
13
  genai.configure(api_key=GOOGLE_API_KEY)
14
 
15
  # Function to get a sarcastic response from Gemini