Akshayram1 commited on
Commit
59db83c
·
verified ·
1 Parent(s): 1ddcf0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -8,8 +8,12 @@ st.title("🎶 Mood-Based Indian Song Player")
8
  # Sidebar for user input
9
  st.sidebar.header("Enter Your Input")
10
 
11
- # Input for Gemini API key
12
- gemini_api_key = st.sidebar.text_input("Enter your Gemini API Key:", type="password")
 
 
 
 
13
 
14
  # Text input for user's mood and context
15
  user_input = st.text_input("Enter your mood and context:",
@@ -88,7 +92,7 @@ if user_input and gemini_api_key:
88
  elif not user_input:
89
  st.warning("Please enter your mood and context.")
90
  elif not gemini_api_key:
91
- st.warning("Please enter your Gemini API key to get started.")
92
 
93
  # Display the playlist
94
  st.sidebar.header("Your Playlist")
 
8
  # Sidebar for user input
9
  st.sidebar.header("Enter Your Input")
10
 
11
+ # Retrieve Gemini API key from secrets
12
+ try:
13
+ gemini_api_key = st.secrets["GEMINI_API_KEY"]
14
+ except KeyError:
15
+ st.error("Gemini API key not found in secrets. Please configure it in your Streamlit secrets.")
16
+ gemini_api_key = None
17
 
18
  # Text input for user's mood and context
19
  user_input = st.text_input("Enter your mood and context:",
 
92
  elif not user_input:
93
  st.warning("Please enter your mood and context.")
94
  elif not gemini_api_key:
95
+ st.warning("Unable to retrieve Gemini API key. Please check your Streamlit secrets configuration.")
96
 
97
  # Display the playlist
98
  st.sidebar.header("Your Playlist")