blazingbunny commited on
Commit
f67c950
·
1 Parent(s): 13768e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -12,8 +12,12 @@ def fetch_data(query, api_key):
12
  # Streamlit UI
13
  st.title('Google Knowledge Graph Search')
14
 
15
- # Fetch API key from secrets.toml
16
- api_key = st.secrets["gkg"]["api_key"]
 
 
 
 
17
 
18
  search_query = st.text_input('Enter Search Query:', 'Python Programming')
19
 
 
12
  # Streamlit UI
13
  st.title('Google Knowledge Graph Search')
14
 
15
+ # Try to fetch API key from secrets.toml
16
+ api_key = st.secrets.get("gkg", {}).get("api_key") if isinstance(st.secrets.get("gkg", {}), dict) else None
17
+
18
+ # If not found, ask for it
19
+ if not api_key:
20
+ api_key = st.text_input('Enter your Google API Key:', type="password")
21
 
22
  search_query = st.text_input('Enter Search Query:', 'Python Programming')
23