larrysim commited on
Commit
36aaf68
·
verified ·
1 Parent(s): e3f4bab

Update app.py

Browse files

fix the indent error

Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -144,23 +144,23 @@ def update_metrics(placeholder):
144
 
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.")
 
144
 
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.")