milwright commited on
Commit
777f0c6
·
1 Parent(s): 69cb0c3

update support_docs.py: remove image refs, reorganize structure, fix outdated content

Browse files
Files changed (1) hide show
  1. support_docs.py +159 -181
support_docs.py CHANGED
@@ -32,100 +32,113 @@ def create_support_docs():
32
  ---
33
  """)
34
 
35
- with gr.Accordion("📝 Step 1: Configure Your Space", open=False):
36
  gr.Markdown("""
37
- ### Configuration Steps
38
-
39
- #### 1a. Templates & Identity
40
- Included are several pre-populated templates to get you started with playful (but applied) configurations. Or start with the "None (Custom)" option for a blank slate. Personalize the chat u/i and giving it a name, header (max 60 char) and a markdown description for the `README.md` file, then select from Gradio themes like Default, Soft, Glass, Monochrome, or Base.
41
- """)
42
 
43
- with gr.Row():
44
- gr.Image(
45
- value="img/quick-start-template.png",
46
- label="Templates & Identity Configuration",
47
- interactive=True,
48
- width=600
49
- )
50
-
51
- gr.Markdown("""
52
- #### 1b. Model Configuration
53
- Craft a system prompt that steers your model's behavior using a well-defined role, context and audience, code of conduct, and/or terms of engagement——think of guardrails as creative constraints. Afterward select a model ID from the menu of options, then experiment with sampling parameters, adjusting temperature (values from 0 to 2) to control response variability and/or setting a token response limit (between 50-4096) to cap output.
54
  """)
55
 
56
- with gr.Row():
57
- with gr.Column(scale=1):
58
- gr.Image(
59
- value="img/model-selection.jpg",
60
- label="System Prompt Configuration",
61
- interactive=False,
62
- width=400
63
- )
64
- with gr.Column(scale=1):
65
- gr.Image(
66
- value="img/system-configuration.jpeg",
67
- label="Model Selection",
68
- interactive=False,
69
- width=400
70
- )
71
-
72
- gr.Markdown("""
73
- #### 1c. Example Prompts
74
- Add 3 to 5 starter prompts that showcase the purpose and design of your space. These examples appear as quick-start buttons for users to try and meant to help them get started.
75
- """)
76
 
77
- with gr.Row():
78
- gr.Image(
79
- value="img/example-prompts.png",
80
- label="Example Prompts Configuration",
81
- interactive=True,
82
- width=600
83
- )
84
-
85
- gr.Markdown("""
86
- #### 1d. URL Grounding
87
- Add up to 10 reference URLs that ground the model in the context of different webpages. The first 2 URLs function as primary sources that will always be loaded with each query, while other URLs serve as supplementary context. Note that only 4096 total characters from URLs are appended to the system prompt.
88
-
89
- #### 1e. API Key and HuggingFace Token
 
 
 
 
 
 
 
90
 
91
- - **Required**: Provide the required OpenAI-standard API key (`sk-`) and name for its variable (`API_KEY`) to call the model through a provider like OpenRouter.
92
- - **Recommended**: Add a HuggingFace token (`HF_TOKEN`) to make your space customizable over time through a configuration editor.
93
- - **Optional**: Set an optional password (`ACCESS_CODE`) to limit who can access your space. Any value goes.
94
-
95
- #### 1f. Upload `config.json`
96
- Done this before? Upload your `config.json` files to redeploy your Space with new settings and recent versions.
97
- """)
 
98
 
99
- with gr.Row():
100
- gr.Image(
101
- value="img/upload-config.png",
102
- label="Upload Configuration",
103
- interactive=False,
104
- width=600
105
- )
106
-
107
- with gr.Accordion("💬 Step 2: Preview Your Assistant", open=False):
108
- gr.Markdown("""
109
- In the Preview tab test your assistant with real-time requests, try example prompts, upload files if enabled, and export your conversation history. Tinker with a variety of queries, models, and configurations to find the most appropriate fit for you and your people.
110
- """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
- with gr.Row():
113
- with gr.Column(scale=1):
114
- gr.Image(
115
- value="img/preview-config.png",
116
- label="Preview Configuration",
117
- interactive=False,
118
- width=400
119
- )
120
- with gr.Column(scale=1):
121
- gr.Image(
122
- value="img/preview-config-screen.png",
123
- label="Preview Interface",
124
- interactive=False,
125
- width=400
126
- )
 
127
 
128
- with gr.Accordion("🗳️ Step 3: Generate & Deploy", open=True):
129
  gr.Markdown("""
130
  ### Deployment Package & HuggingFace Space Setup
131
 
@@ -134,121 +147,86 @@ def create_support_docs():
134
  - `requirements.txt`: Python dependencies
135
  - `config.json`: Configuration backup
136
  - `README.md`: Deployment instructions
137
-
138
- **Deployment Overview:** Generate Package and Create Space → Upload Files and Configure Secrets → Monitor Build and Verify
139
  """)
140
 
141
- with gr.Accordion("Step 3a: Generate & Create Space", open=False):
142
  gr.Markdown("""
143
  **Generate Deployment Package**
144
- - Click "🗳️ Generate Deployment Package" in Configuration tab
145
- - Download the generated ZIP file
146
- - Extract files: `app.py`, `config.json`, `requirements.txt`, `README.md`
147
 
148
  **Create New Space**
149
- - Go to [huggingface.co/spaces](https://huggingface.co/spaces)
150
- - Click "New Space"
151
- - Choose Gradio SDK (Blank)
152
- - Select hardware (CPU Basic is free)
 
 
 
153
  """)
154
-
155
- with gr.Row():
156
- with gr.Column(scale=1):
157
- gr.Image(
158
- value="img/new-space-gradio-blank.png",
159
- label="Space Creation Form",
160
- interactive=False,
161
- width=400
162
- )
163
- with gr.Column(scale=1):
164
- gr.Image(
165
- value="img/space-hardware.png",
166
- label="Hardware Selection",
167
- interactive=False,
168
- width=400
169
- )
170
 
171
- with gr.Accordion("Step 3b: Upload Files", open=False):
172
  gr.Markdown("""
173
- **2.1 Upload Project Files**
174
- - Navigate to Files tab
175
- - Click "Upload files" or drag and drop
176
- - Upload: `README.md`, `app.py`, `config.json`, `requirements.txt`
177
- - Commit directly to main branch
 
 
 
 
 
178
  """)
179
-
180
- with gr.Row():
181
- with gr.Column(scale=1):
182
- gr.Image(
183
- value="img/upload-files.png",
184
- label="File Upload",
185
- interactive=False,
186
- width=400
187
- )
188
- with gr.Column(scale=1):
189
- gr.Image(
190
- value="img/highlight-files.png",
191
- label="Files After Upload",
192
- interactive=False,
193
- width=400
194
- )
195
 
196
- with gr.Accordion("Step 3c: Configure API Secrets", open=False):
197
  gr.Markdown("""
198
- **Configure HuggingFace Spaces Secrets**
199
- - Go to Settings Variables and secrets
200
- - Click "New secret"
 
201
 
202
- **Required Secret:**
203
- - `API_KEY` (or your configured variable name)
204
- - Must start with: `sk-or-`
205
- - Add in: *Settings* → *Variables and secrets*
206
 
207
- **Optional Secrets:**
208
- - `HF_TOKEN` (Recommended): Enables persistent updates & customization
 
209
  - Get from: https://huggingface.co/settings/tokens
210
- - Enable *write* permissions
211
-
212
- - `ACCESS_CODE`: Password protects your Space
213
- - To enable add secret `ACCESS_CODE` with a custom value
214
- - To disable delete `ACCESS_CODE` secret entirely from *Variables and Secrets*
215
- - Share with authorized users only
216
 
217
- **Access Control Notes:**
218
- - Do NOT set an empty value - either set a code or don't create the secret at all
 
 
219
  """)
220
-
221
- with gr.Row():
222
-
223
- with gr.Column(scale=1):
224
- gr.Image(
225
- value="img/go-to-settings.png",
226
- label="Navigating to Settings",
227
- interactive=False,
228
- width=400
229
- )
230
-
231
- with gr.Column(scale=1):
232
- gr.Image(
233
- value="img/variables-and-secrets.png",
234
- label="API Key Secret Configuration",
235
- interactive=False,
236
- width=400
237
- )
238
 
239
- with gr.Accordion("Step 3d: Verify Build & Iterate", open=False):
240
  gr.Markdown("""
241
- **Verify Build**
242
- - Space will show "Building..." status
243
- - Monitor build logs for errors
244
- - Wait 1-3 minutes for completion
245
- - Test chat interface with example prompts
246
-
247
- **Iterate Configuration**
248
- - Use the configuration editor to make changes
249
- - Click "Save Configuration" to update
250
- - Wait for the space to rebuild
251
- - Test again with new settings
 
 
 
 
 
 
 
 
 
252
  """)
253
 
254
  gr.Markdown("""
 
32
  ---
33
  """)
34
 
35
+ with gr.Accordion("📝 Step 1: Configure & Preview Your Space", open=False):
36
  gr.Markdown("""
37
+ ### Configuration Tab Overview
 
 
 
 
38
 
39
+ Configure your assistant through various sections in the Configuration tab, then test it in the Preview tab before generating your deployment package.
 
 
 
 
 
 
 
 
 
 
40
  """)
41
 
42
+ with gr.Accordion("Step 1a: Templates & Identity", open=False):
43
+ gr.Markdown("""
44
+ **Quick Start Templates**
45
+ - Choose from pre-configured academic templates (Socratic Research Chat, STEM Adventure Games, etc.)
46
+ - Or select "None (Custom)" for a blank slate
47
+
48
+ **Space Identity**
49
+ - **Assistant Name**: Give your assistant a memorable name
50
+ - **Tagline**: Brief description (max 60 characters) for HuggingFace YAML frontmatter
51
+ - **Description**: Full markdown description for the README
52
+ - **Theme**: Select from Gradio themes (Default, Soft, Glass, Monochrome, Base)
53
+ """)
 
 
 
 
 
 
 
 
54
 
55
+ with gr.Accordion("Step 1b: System Configuration", open=False):
56
+ gr.Markdown("""
57
+ **System Prompt**
58
+ - Define your assistant's role, context, and behavior
59
+ - Set guardrails and creative constraints
60
+ - Specify audience and terms of engagement
61
+
62
+ **Model Selection**
63
+ - Choose from available models (Gemini, Claude, GPT, Mistral, etc.)
64
+ - Or enter a custom model ID
65
+
66
+ **Language Support**
67
+ - Configure language through system prompt instructions
68
+ - Assistant can be instructed to respond exclusively in any language
69
+ - See "Language Learning Partner" template for Italian example
70
+
71
+ **Sampling Parameters**
72
+ - **Temperature** (0-2): Controls response variability
73
+ - **Max Tokens** (50-4096): Limits response length
74
+ """)
75
 
76
+ with gr.Accordion("Step 1c: Example Prompts", open=False):
77
+ gr.Markdown("""
78
+ **Example Prompts**
79
+ - Add 3-5 starter prompts that showcase your assistant's capabilities
80
+ - These appear as quick-start buttons for users
81
+ - Help users understand how to interact with your assistant
82
+ - Use the ➕/➖ buttons to add or remove examples
83
+ """)
84
 
85
+ with gr.Accordion("Step 1d: URL Grounding", open=False):
86
+ gr.Markdown("""
87
+ **Grounding URLs**
88
+ - Add up to 10 reference URLs to provide context
89
+ - **Primary Sources (URLs 1-2)**: Always loaded, up to 8000 characters each
90
+ - **Secondary Sources (URLs 3+)**: Supplementary context, up to 2500 characters each
91
+ - URLs are fetched and included in the system prompt
92
+ - Assistant will cite specific URLs when using grounded information
93
+ - Use the ➕/➖ buttons to manage URLs
94
+ """)
95
+
96
+ with gr.Accordion("Step 1e: API Configuration", open=False):
97
+ gr.Markdown("""
98
+ **Required Secrets**
99
+ - **API_KEY**: Your OpenRouter API key (must start with `sk-or-`)
100
+ - Get from: https://openrouter.ai/keys
101
+ - Configure in HuggingFace Space settings
102
+
103
+ **Optional Secrets**
104
+ - **HF_TOKEN** (Recommended): Enables configuration editor in deployed Space
105
+ - Get from: https://huggingface.co/settings/tokens
106
+ - Select "write" permissions when creating
107
+ - Allows updating configuration without redeployment
108
+
109
+ - **ACCESS_CODE**: Password-protect your Space
110
+ - Set any password value
111
+ - Users will need this code to access
112
+ - Leave unset for public access
113
+ """)
114
+
115
+ with gr.Accordion("Step 1f: Upload Configuration", open=False):
116
+ gr.Markdown("""
117
+ **Upload Existing Configuration**
118
+ - Have a previous `config.json` file?
119
+ - Use the "Upload Configuration" accordion
120
+ - Drag and drop or click to upload
121
+ - All settings will be restored automatically
122
+ """)
123
 
124
+ with gr.Accordion("Step 1g: Preview Your Assistant", open=False):
125
+ gr.Markdown("""
126
+ **Testing in Preview Tab**
127
+ - Click "💬 Preview Configuration" to prepare your assistant
128
+ - Switch to the Preview tab
129
+ - Test with real queries and example prompts
130
+ - Upload files if file upload is enabled
131
+ - Export conversation history as markdown
132
+
133
+ **Preview Features**
134
+ - Real-time API responses (requires API key in environment)
135
+ - Grounding context from configured URLs
136
+ - Language-specific responses
137
+ - File upload handling
138
+ - Conversation export
139
+ """)
140
 
141
+ with gr.Accordion("🗳️ Step 2: Generate & Deploy", open=True):
142
  gr.Markdown("""
143
  ### Deployment Package & HuggingFace Space Setup
144
 
 
147
  - `requirements.txt`: Python dependencies
148
  - `config.json`: Configuration backup
149
  - `README.md`: Deployment instructions
150
+
151
+ **Deployment Overview:** Generate Package Create Space → Upload Files Configure Secrets → Monitor Build
152
  """)
153
 
154
+ with gr.Accordion("Step 2a: Generate & Create Space", open=False):
155
  gr.Markdown("""
156
  **Generate Deployment Package**
157
+ 1. Click "🗳️ Generate Deployment Package" in Configuration tab
158
+ 2. Download the generated ZIP file
159
+ 3. Extract files: `app.py`, `config.json`, `requirements.txt`, `README.md`
160
 
161
  **Create New Space**
162
+ 1. Go to [huggingface.co/spaces](https://huggingface.co/spaces)
163
+ 2. Click "Create new Space"
164
+ 3. Name your Space
165
+ 4. Select **Gradio** SDK
166
+ 5. Choose **Blank** template
167
+ 6. Select hardware (CPU Basic is free)
168
+ 7. Click "Create Space"
169
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
 
171
+ with gr.Accordion("Step 2b: Upload Files", open=False):
172
  gr.Markdown("""
173
+ **Upload Project Files**
174
+ 1. Navigate to the **Files** tab in your new Space
175
+ 2. Click "Add file" "Upload files"
176
+ 3. Select all 4 files from your extracted package:
177
+ - `README.md`
178
+ - `app.py`
179
+ - `config.json`
180
+ - `requirements.txt`
181
+ 4. Commit directly to main branch
182
+ 5. Your Space will automatically start building
183
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
+ with gr.Accordion("Step 2c: Configure Secrets", open=False):
186
  gr.Markdown("""
187
+ **Navigate to Settings**
188
+ 1. Click the **Settings** tab in your Space
189
+ 2. Find **Variables and secrets** section
190
+ 3. Click **New secret**
191
 
192
+ **Add Required Secret**
193
+ - **Name**: `API_KEY` (or your configured variable name)
194
+ - **Value**: Your OpenRouter API key
195
+ - Must start with `sk-or-`
196
 
197
+ **Add Optional Secrets (if desired)**
198
+ - **HF_TOKEN**: Your HuggingFace token with write permissions
199
+ - Enables the configuration editor in your Space
200
  - Get from: https://huggingface.co/settings/tokens
 
 
 
 
 
 
201
 
202
+ - **ACCESS_CODE**: Any password value
203
+ - Restricts access to authorized users
204
+ - Do NOT set an empty value
205
+ - Either set a code or don't create the secret
206
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
+ with gr.Accordion("Step 2d: Verify & Iterate", open=False):
209
  gr.Markdown("""
210
+ **Monitor Build Process**
211
+ 1. Return to the **App** tab
212
+ 2. Watch for "Building..." status
213
+ 3. Check build logs for any errors
214
+ 4. Wait 1-3 minutes for completion
215
+ 5. Space will show "Running" when ready
216
+
217
+ **Test Your Deployment**
218
+ 1. Try the example prompts
219
+ 2. Test different types of queries
220
+ 3. Verify grounding URLs are working
221
+ 4. Check language responses (if configured)
222
+
223
+ **Iterate Configuration (with HF_TOKEN)**
224
+ 1. Go to ⚙️ Configuration tab in your Space
225
+ 2. Enter your HF_TOKEN to authenticate
226
+ 3. Modify settings as needed
227
+ 4. Click "Save Configuration"
228
+ 5. Space will automatically rebuild
229
+ 6. Test new configuration
230
  """)
231
 
232
  gr.Markdown("""