Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,14 @@ import streamlit as st
|
|
| 2 |
import google.generativeai as genai
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
GOOGLE_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
|