Spaces:
Build error
Build error
sercuring api key
Browse files
app.py
CHANGED
|
@@ -1,8 +1,16 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import google.generativeai as genai
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Set up Gemini API
|
| 5 |
-
genai.configure(api_key=
|
| 6 |
|
| 7 |
# Set up the model
|
| 8 |
generation_config = {
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import google.generativeai as genai
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
# Securely fetch the API key from environment variables
|
| 6 |
+
api_key = os.getenv("GEMINI_API_KEY")
|
| 7 |
+
|
| 8 |
+
if not api_key:
|
| 9 |
+
st.error("API key not found. Please set the GEMINI_API_KEY environment variable.")
|
| 10 |
+
st.stop()
|
| 11 |
|
| 12 |
# Set up Gemini API
|
| 13 |
+
genai.configure(api_key=api_key)
|
| 14 |
|
| 15 |
# Set up the model
|
| 16 |
generation_config = {
|