milwright commited on
Commit
2d896a6
Β·
1 Parent(s): bd13718

update env var display

Browse files
Files changed (1) hide show
  1. app.py +18 -36
app.py CHANGED
@@ -244,18 +244,16 @@ class SpaceGenerator:
244
  remove_url_btn = gr.Button("βž– Remove URL", size="sm", visible=False)
245
 
246
  # Environment Variables
247
- with gr.Group():
248
- gr.Markdown("### πŸ”‘ Environment Variables")
249
- gr.Markdown(
250
- "Configure the required secrets in your HuggingFace Space settings."
251
- )
252
 
253
  # Required API Key on its own row
254
  self.api_key_var_input = gr.Textbox(
255
  label="API Key Variable Name (Required)",
256
  value="API_KEY",
257
  info="Environment variable for OpenRouter API key",
258
- interactive=False # Make non-editable
 
259
  )
260
 
261
  # Optional variables on the same row
@@ -265,50 +263,34 @@ class SpaceGenerator:
265
  label="HF Token Variable Name",
266
  value="HF_TOKEN",
267
  info="Environment variable for HuggingFace token",
268
- interactive=False # Make non-editable
 
269
  )
270
  self.access_code_input = gr.Textbox(
271
  label="Access Code Variable",
272
  value="ACCESS_CODE",
273
  info="Environment variable for password protection",
274
- interactive=False # Make non-editable
 
275
  )
276
 
277
  # Instructions
278
  with gr.Accordion("πŸ“– Step-by-Step Instructions", open=False):
279
  gr.Markdown(
280
- """### How to Configure Secrets in HuggingFace Spaces
281
-
282
- **Step 1: Navigate to Settings**
283
- - Go to your HuggingFace Space
284
- - Click on the βš™οΈ **Settings** tab at the top
285
-
286
- **Step 2: Access Variables and Secrets**
287
- - Scroll down to find **Variables and secrets** section
288
- - Click on **New secret** button
289
-
290
- **Step 3: Add Required Secrets**
291
-
292
- > πŸ’‘ **Visual Guide**: The screenshot below shows the "New secret" dialog where you'll enter your API key:
293
- > ![Adding API Key Secret](img/add-secret-api.png)
294
 
295
- Add the following secrets to your Space:
 
 
296
 
297
- 1. **API_KEY** - Your OpenRouter API key (required)
298
- - Name: `API_KEY` (exactly as shown)
299
- - Get your key at: https://openrouter.ai/keys
300
- - Value should start with `sk-or-`
301
- - This enables AI responses
302
 
303
- 2. **HF_TOKEN** - Your HuggingFace token (optional)
304
- - Enables automatic configuration updates
305
- - Get your token at: https://huggingface.co/settings/tokens
306
- - Select "write" permission when creating token
307
 
308
- 3. **ACCESS_CODE** - Password protection (optional)
309
- - Set any password to restrict access
310
- - Users will need this code to access your Space
311
- - Leave empty for public access
312
  """
313
  )
314
 
 
244
  remove_url_btn = gr.Button("βž– Remove URL", size="sm", visible=False)
245
 
246
  # Environment Variables
247
+ with gr.Accordion("πŸ”‘ Environment Variables", open=False):
248
+ gr.Markdown("Configure the required secrets in your HuggingFace Space settings.")
 
 
 
249
 
250
  # Required API Key on its own row
251
  self.api_key_var_input = gr.Textbox(
252
  label="API Key Variable Name (Required)",
253
  value="API_KEY",
254
  info="Environment variable for OpenRouter API key",
255
+ interactive=False,
256
+ show_copy_button=True
257
  )
258
 
259
  # Optional variables on the same row
 
263
  label="HF Token Variable Name",
264
  value="HF_TOKEN",
265
  info="Environment variable for HuggingFace token",
266
+ interactive=False,
267
+ show_copy_button=True
268
  )
269
  self.access_code_input = gr.Textbox(
270
  label="Access Code Variable",
271
  value="ACCESS_CODE",
272
  info="Environment variable for password protection",
273
+ interactive=False,
274
+ show_copy_button=True
275
  )
276
 
277
  # Instructions
278
  with gr.Accordion("πŸ“– Step-by-Step Instructions", open=False):
279
  gr.Markdown(
280
+ """### How to Configure Secrets
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
+ 1. Go to your Space β†’ Click **βš™οΈ Settings** tab
283
+ 2. Find **Variables and secrets** β†’ Click **New secret**
284
+ 3. Add your secrets:
285
 
286
+ ![Adding API Key Secret](img/add-secret-api.png)
 
 
 
 
287
 
288
+ **Required:**
289
+ - `API_KEY` - Your OpenRouter key from https://openrouter.ai/keys
 
 
290
 
291
+ **Optional:**
292
+ - `HF_TOKEN` - For auto-updates (get from https://huggingface.co/settings/tokens)
293
+ - `ACCESS_CODE` - For password protection
 
294
  """
295
  )
296