davidlms commited on
Commit
e3b6e61
·
verified ·
1 Parent(s): a12963b

Update describepdf/ui.py

Browse files
Files changed (1) hide show
  1. describepdf/ui.py +7 -4
describepdf/ui.py CHANGED
@@ -218,11 +218,14 @@ def create_ui() -> gr.Blocks:
218
  "Adjust settings for the *next* generation. These settings are **not** saved. "
219
  "Defaults are controlled by the `.env` file."
220
  )
 
 
 
221
  api_key_input = gr.Textbox(
222
- label="OpenRouter API Key" + (" (set in .env)" if has_env_api_key else ""),
223
- type="password",
224
- placeholder="Enter an API key here to override the one in .env" if has_env_api_key else "Enter your OpenRouter API key",
225
- value=""
226
  )
227
  vlm_model_input = gr.Dropdown(
228
  label="VLM Model",
 
218
  "Adjust settings for the *next* generation. These settings are **not** saved. "
219
  "Defaults are controlled by the `.env` file."
220
  )
221
+ api_key_from_secret = os.environ.get("OPENROUTER_API_KEY", "")
222
+ has_secret_api_key = bool(api_key_from_secret)
223
+
224
  api_key_input = gr.Textbox(
225
+ label="OpenRouter API Key" + (" (set in Secrets)" if has_secret_api_key else " (set in .env)" if has_env_api_key else ""),
226
+ type="password",
227
+ placeholder="Enter an API key here to override the stored one" if has_secret_api_key or has_env_api_key else "Enter your OpenRouter API key",
228
+ value=api_key_from_secret
229
  )
230
  vlm_model_input = gr.Dropdown(
231
  label="VLM Model",