Spaces:
Running
Running
milwright
commited on
Commit
Β·
2d896a6
1
Parent(s):
bd13718
update env var display
Browse files
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.
|
248 |
-
gr.Markdown("
|
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
|
|
|
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
|
|
|
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
|
|
|
275 |
)
|
276 |
|
277 |
# Instructions
|
278 |
with gr.Accordion("π Step-by-Step Instructions", open=False):
|
279 |
gr.Markdown(
|
280 |
-
"""### How to Configure Secrets
|
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 |
-
> 
|
294 |
|
295 |
-
|
|
|
|
|
296 |
|
297 |
-
|
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 |
-
|
304 |
-
|
305 |
-
- Get your token at: https://huggingface.co/settings/tokens
|
306 |
-
- Select "write" permission when creating token
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
|
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 |
+

|
|
|
|
|
|
|
|
|
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 |
|