larrysim commited on
Commit
fcc2b2d
·
verified ·
1 Parent(s): 94f60e4

Update app.py

Browse files

fix indent error

Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -145,22 +145,22 @@ def update_metrics(placeholder):
145
  # --- SIDEBAR ---
146
  with st.sidebar:
147
  st.header("🔐 Authentication")
148
-
149
- # 1. SAFELY Check Secrets (Prevents FileNotFoundError)
150
- try:
151
- if "GROQ_API_KEY" in st.secrets:
152
- st.session_state['groq_api_key'] = st.secrets["GROQ_API_KEY"]
153
- st.session_state['is_key_valid'] = True
154
- except FileNotFoundError:
155
- # If secrets.toml doesn't exist, ignore and fall back to manual entry
156
- pass
157
-
158
- # 2. Manual Entry Logic
159
- if 'is_key_valid' not in st.session_state:
160
- st.session_state['is_key_valid'] = False
161
 
162
- if not st.session_state['is_key_valid']:
163
- api_key_input = st.text_input("Enter Groq API Key", type="password", key="input_key")
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  if st.button("Validate API Key"):
165
  if not api_key_input:
166
  st.error("⚠️ Please enter a key.")
 
145
  # --- SIDEBAR ---
146
  with st.sidebar:
147
  st.header("🔐 Authentication")
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
+ # 1. SAFELY Check Secrets (Prevents FileNotFoundError)
150
+ try:
151
+ if "GROQ_API_KEY" in st.secrets:
152
+ st.session_state['groq_api_key'] = st.secrets["GROQ_API_KEY"]
153
+ st.session_state['is_key_valid'] = True
154
+ except FileNotFoundError:
155
+ # If secrets.toml doesn't exist, ignore and fall back to manual entry
156
+ pass
157
+
158
+ # 2. Manual Entry Logic
159
+ if 'is_key_valid' not in st.session_state:
160
+ st.session_state['is_key_valid'] = False
161
+
162
+ if not st.session_state['is_key_valid']:
163
+ api_key_input = st.text_input("Enter Groq API Key", type="password", key="input_key")
164
  if st.button("Validate API Key"):
165
  if not api_key_input:
166
  st.error("⚠️ Please enter a key.")