Romanchello-bit commited on
Commit
eb2b942
·
1 Parent(s): f41fb66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -216,10 +216,18 @@ def draw_graph(graph_data, current_node, predicted_path):
216
  # --- MAIN APP ---
217
  st.sidebar.title("🛠️ SellMe Control")
218
 
219
- # --- API KEY SETUP (Cloud + Local) ---
220
- if "GOOGLE_API_KEY" in st.secrets:
221
- api_key = st.secrets["GOOGLE_API_KEY"]
222
- else:
 
 
 
 
 
 
 
 
223
  api_key = st.sidebar.text_input("Google API Key", type="password")
224
 
225
  if st.sidebar.button("📊 Dashboard"): st.session_state.page = "dashboard"; st.rerun()
 
216
  # --- MAIN APP ---
217
  st.sidebar.title("🛠️ SellMe Control")
218
 
219
+ # --- API KEY SETUP (Robust) ---
220
+ api_key = None
221
+ try:
222
+ # Try to get key from secrets (Cloud)
223
+ if "GOOGLE_API_KEY" in st.secrets:
224
+ api_key = st.secrets["GOOGLE_API_KEY"]
225
+ except (FileNotFoundError, KeyError):
226
+ # Secrets not found (Local run) -> Do nothing, stay None
227
+ pass
228
+
229
+ # Fallback to manual input if no key found yet
230
+ if not api_key:
231
  api_key = st.sidebar.text_input("Google API Key", type="password")
232
 
233
  if st.sidebar.button("📊 Dashboard"): st.session_state.page = "dashboard"; st.rerun()