lily0n commited on
Commit
af2f7f5
·
verified ·
1 Parent(s): 5859c23

sercuring api key

Browse files
Files changed (1) hide show
  1. app.py +9 -1
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="AIzaSyBQqw4RV3XdTFuPud7mkoHNPfxQm5EnOrc") # Replace with your Gemini 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 = {