Wauplin HF Staff commited on
Commit
fee7923
·
verified ·
1 Parent(s): e41cca0

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. app.js +12 -0
  2. index.html +117 -16
  3. style.css +78 -0
app.js CHANGED
@@ -1019,6 +1019,18 @@ function initEventListeners() {
1019
  connectS3();
1020
  }
1021
  });
 
 
 
 
 
 
 
 
 
 
 
 
1022
  }
1023
 
1024
  // ============================================================
 
1019
  connectS3();
1020
  }
1021
  });
1022
+
1023
+ // Help toggle buttons
1024
+ document.addEventListener("click", (e) => {
1025
+ const toggle = e.target.closest(".help-toggle");
1026
+ if (!toggle) return;
1027
+ e.preventDefault();
1028
+ const helpId = toggle.dataset.help;
1029
+ if (!helpId) return;
1030
+ const helpEl = document.getElementById(helpId);
1031
+ if (!helpEl) return;
1032
+ helpEl.classList.toggle("visible");
1033
+ });
1034
  }
1035
 
1036
  // ============================================================
index.html CHANGED
@@ -64,31 +64,77 @@
64
  <h2>Connect to S3</h2>
65
  <span id="s3-status" class="card-status hidden"></span>
66
  </div>
 
 
 
 
67
  <div class="form-grid">
68
  <div class="form-group">
69
- <label>AWS Access Key ID <span class="required">*</span></label>
 
 
 
70
  <input type="text" id="aws-access-key" placeholder="AKIA..." autocomplete="off" spellcheck="false">
 
 
 
 
 
71
  </div>
72
  <div class="form-group">
73
- <label>AWS Secret Access Key <span class="required">*</span></label>
 
 
 
74
  <input type="password" id="aws-secret-key" placeholder="Your secret key" autocomplete="off">
 
 
 
 
75
  </div>
76
  <div class="form-group">
77
- <label>AWS Region</label>
 
 
 
78
  <input type="text" id="aws-region" value="us-east-1" placeholder="us-east-1">
 
 
 
 
79
  </div>
80
  <div class="form-group">
81
- <label>S3 Bucket Name <span class="required">*</span></label>
 
 
 
82
  <input type="text" id="s3-bucket" placeholder="my-data-bucket" spellcheck="false">
 
 
 
 
83
  </div>
84
  <div class="form-group">
85
- <label>Endpoint URL <span class="text-muted">(optional, for S3-compatible services)</span></label>
 
 
 
86
  <input type="text" id="s3-endpoint" placeholder="https://s3.example.com" spellcheck="false">
 
 
 
 
87
  </div>
88
  <div class="form-group">
89
- <label>Source Prefix <span class="text-muted">(optional)</span></label>
 
 
 
90
  <input type="text" id="s3-prefix" placeholder="data/exports/" spellcheck="false">
91
- <span class="hint">Only import files under this prefix</span>
 
 
 
92
  </div>
93
  </div>
94
  <div class="form-actions">
@@ -170,22 +216,47 @@
170
  <h2>Configure Import</h2>
171
  </div>
172
 
 
 
 
 
 
173
  <div class="form-grid">
174
  <div class="form-group">
175
- <label>Destination Bucket <span class="required">*</span></label>
 
 
 
176
  <input type="text" id="dest-bucket" placeholder="my-bucket or namespace/my-bucket" spellcheck="false">
177
- <span class="hint">Use <code>namespace/bucket</code> or just <code>bucket</code> (defaults to your username)</span>
 
 
 
 
 
178
  </div>
179
  <div class="form-group">
180
- <label>Destination Prefix <span class="text-muted">(optional)</span></label>
 
 
 
181
  <input type="text" id="dest-prefix" placeholder="imported/2024/" spellcheck="false">
182
- <span class="hint">Import files under this folder in the bucket</span>
 
 
 
 
183
  </div>
184
  </div>
185
 
186
  <div class="form-group mt-4" style="flex-direction: row; align-items: center; gap: 8px;">
187
  <input type="checkbox" id="dest-private" checked style="accent-color: var(--accent); width: 16px; height: 16px;">
188
  <label for="dest-private" style="margin: 0; cursor: pointer;">Create bucket as private</label>
 
 
 
 
 
189
  </div>
190
 
191
  <div id="dest-preview" class="dest-preview mt-4 hidden"></div>
@@ -194,19 +265,36 @@
194
 
195
  <div class="config-row">
196
  <div class="form-group">
197
- <label>Hardware</label>
 
 
 
198
  <select id="job-flavor">
199
  <option value="cpu-basic">CPU Basic ($0.04/hr)</option>
200
  <option value="cpu-upgrade">CPU Upgrade ($0.07/hr)</option>
201
  </select>
 
 
 
 
 
202
  </div>
203
  <div class="form-group">
204
- <label>Workers</label>
 
 
 
205
  <input type="number" id="job-workers" value="4" min="1" max="16">
206
- <span class="hint">Parallel download threads</span>
 
 
 
207
  </div>
208
  <div class="form-group">
209
- <label>Timeout</label>
 
 
 
210
  <select id="job-timeout">
211
  <option value="1800">30 minutes</option>
212
  <option value="3600">1 hour</option>
@@ -214,11 +302,24 @@
214
  <option value="21600">6 hours</option>
215
  <option value="43200">12 hours</option>
216
  </select>
 
 
 
 
 
217
  </div>
218
  </div>
219
 
220
  <div id="patterns-info" class="hidden">
221
- <label style="font-size: 13px; font-weight: 500; color: var(--text-secondary);">Import Command Preview</label>
 
 
 
 
 
 
 
 
222
  <div id="patterns-preview" class="patterns-preview mt-4"></div>
223
  </div>
224
 
 
64
  <h2>Connect to S3</h2>
65
  <span id="s3-status" class="card-status hidden"></span>
66
  </div>
67
+ <div class="section-help">
68
+ Provide your AWS credentials so we can list your S3 bucket contents.
69
+ Credentials are only used in your browser to browse files, then passed as encrypted secrets to the import Job. They are never stored.
70
+ </div>
71
  <div class="form-grid">
72
  <div class="form-group">
73
+ <div class="label-row">
74
+ <label>AWS Access Key ID <span class="required">*</span></label>
75
+ <button type="button" class="help-toggle" data-help="help-access-key">?</button>
76
+ </div>
77
  <input type="text" id="aws-access-key" placeholder="AKIA..." autocomplete="off" spellcheck="false">
78
+ <div id="help-access-key" class="field-help">
79
+ Your IAM access key ID, starting with <code>AKIA</code>. You can create one in the
80
+ <a href="https://console.aws.amazon.com/iam/home#/security_credentials" target="_blank" rel="noopener">AWS IAM Console</a>
81
+ under "Access keys". We recommend using a key with read-only S3 permissions.
82
+ </div>
83
  </div>
84
  <div class="form-group">
85
+ <div class="label-row">
86
+ <label>AWS Secret Access Key <span class="required">*</span></label>
87
+ <button type="button" class="help-toggle" data-help="help-secret-key">?</button>
88
+ </div>
89
  <input type="password" id="aws-secret-key" placeholder="Your secret key" autocomplete="off">
90
+ <div id="help-secret-key" class="field-help">
91
+ The secret key paired with your Access Key ID. It was shown only once when you created the access key.
92
+ This value is sent to the HF Job as an encrypted secret and is never logged or stored.
93
+ </div>
94
  </div>
95
  <div class="form-group">
96
+ <div class="label-row">
97
+ <label>AWS Region</label>
98
+ <button type="button" class="help-toggle" data-help="help-region">?</button>
99
+ </div>
100
  <input type="text" id="aws-region" value="us-east-1" placeholder="us-east-1">
101
+ <div id="help-region" class="field-help">
102
+ The AWS region where your S3 bucket is hosted, e.g. <code>us-east-1</code>, <code>eu-west-1</code>, <code>ap-southeast-1</code>.
103
+ You can find this in the AWS Console next to your bucket name, or in the bucket's Properties tab.
104
+ </div>
105
  </div>
106
  <div class="form-group">
107
+ <div class="label-row">
108
+ <label>S3 Bucket Name <span class="required">*</span></label>
109
+ <button type="button" class="help-toggle" data-help="help-bucket-name">?</button>
110
+ </div>
111
  <input type="text" id="s3-bucket" placeholder="my-data-bucket" spellcheck="false">
112
+ <div id="help-bucket-name" class="field-help">
113
+ The name of your S3 bucket (not the full ARN or URL). For example, if your bucket URL is
114
+ <code>s3://my-data-bucket</code>, enter <code>my-data-bucket</code>.
115
+ </div>
116
  </div>
117
  <div class="form-group">
118
+ <div class="label-row">
119
+ <label>Endpoint URL <span class="text-muted">(optional)</span></label>
120
+ <button type="button" class="help-toggle" data-help="help-endpoint">?</button>
121
+ </div>
122
  <input type="text" id="s3-endpoint" placeholder="https://s3.example.com" spellcheck="false">
123
+ <div id="help-endpoint" class="field-help">
124
+ Only needed for S3-compatible services (MinIO, DigitalOcean Spaces, Cloudflare R2, etc.).
125
+ Leave empty for standard AWS S3. Example: <code>https://nyc3.digitaloceanspaces.com</code>
126
+ </div>
127
  </div>
128
  <div class="form-group">
129
+ <div class="label-row">
130
+ <label>Source Prefix <span class="text-muted">(optional)</span></label>
131
+ <button type="button" class="help-toggle" data-help="help-prefix">?</button>
132
+ </div>
133
  <input type="text" id="s3-prefix" placeholder="data/exports/" spellcheck="false">
134
+ <div id="help-prefix" class="field-help">
135
+ Filter to a subfolder within your bucket. Only files under this path will be listed and imported.
136
+ For example, <code>data/exports/</code> will only show files starting with that path. Leave empty to browse the entire bucket.
137
+ </div>
138
  </div>
139
  </div>
140
  <div class="form-actions">
 
216
  <h2>Configure Import</h2>
217
  </div>
218
 
219
+ <div class="section-help">
220
+ Choose where to import your files on Hugging Face. The bucket will be created automatically if it doesn't exist yet.
221
+ The import runs as an <a href="https://huggingface.co/docs/hub/jobs" target="_blank" rel="noopener">HF Job</a> on Hugging Face infrastructure &mdash; your browser does not need to stay open.
222
+ </div>
223
+
224
  <div class="form-grid">
225
  <div class="form-group">
226
+ <div class="label-row">
227
+ <label>Destination Bucket <span class="required">*</span></label>
228
+ <button type="button" class="help-toggle" data-help="help-dest-bucket">?</button>
229
+ </div>
230
  <input type="text" id="dest-bucket" placeholder="my-bucket or namespace/my-bucket" spellcheck="false">
231
+ <div id="help-dest-bucket" class="field-help">
232
+ The HF Storage Bucket to import files into. You can use:<br>
233
+ &bull; <code>bucket-name</code> &mdash; creates under your username (<code>username/bucket-name</code>)<br>
234
+ &bull; <code>org/bucket-name</code> &mdash; creates under a specific organization<br>
235
+ The bucket will be created for you if it doesn't exist yet.
236
+ </div>
237
  </div>
238
  <div class="form-group">
239
+ <div class="label-row">
240
+ <label>Destination Prefix <span class="text-muted">(optional)</span></label>
241
+ <button type="button" class="help-toggle" data-help="help-dest-prefix">?</button>
242
+ </div>
243
  <input type="text" id="dest-prefix" placeholder="imported/2024/" spellcheck="false">
244
+ <div id="help-dest-prefix" class="field-help">
245
+ Place imported files under this path within the bucket. For example, <code>imported/2024/</code>
246
+ will import <code>file.txt</code> as <code>imported/2024/file.txt</code> in the bucket.
247
+ Leave empty to import at the bucket root.
248
+ </div>
249
  </div>
250
  </div>
251
 
252
  <div class="form-group mt-4" style="flex-direction: row; align-items: center; gap: 8px;">
253
  <input type="checkbox" id="dest-private" checked style="accent-color: var(--accent); width: 16px; height: 16px;">
254
  <label for="dest-private" style="margin: 0; cursor: pointer;">Create bucket as private</label>
255
+ <button type="button" class="help-toggle" data-help="help-private">?</button>
256
+ </div>
257
+ <div id="help-private" class="field-help" style="margin-top: 4px;">
258
+ Private buckets are only accessible to you (and your organization members).
259
+ Uncheck to make the bucket publicly readable. This only applies when creating a new bucket &mdash; existing buckets keep their current visibility.
260
  </div>
261
 
262
  <div id="dest-preview" class="dest-preview mt-4 hidden"></div>
 
265
 
266
  <div class="config-row">
267
  <div class="form-group">
268
+ <div class="label-row">
269
+ <label>Hardware</label>
270
+ <button type="button" class="help-toggle" data-help="help-hardware">?</button>
271
+ </div>
272
  <select id="job-flavor">
273
  <option value="cpu-basic">CPU Basic ($0.04/hr)</option>
274
  <option value="cpu-upgrade">CPU Upgrade ($0.07/hr)</option>
275
  </select>
276
+ <div id="help-hardware" class="field-help">
277
+ The machine type for the import Job. S3-to-bucket transfer is network-bound, so CPU is sufficient.
278
+ <code>CPU Upgrade</code> provides more memory and bandwidth for very large imports.
279
+ You are billed per second of Job runtime.
280
+ </div>
281
  </div>
282
  <div class="form-group">
283
+ <div class="label-row">
284
+ <label>Workers</label>
285
+ <button type="button" class="help-toggle" data-help="help-workers">?</button>
286
+ </div>
287
  <input type="number" id="job-workers" value="4" min="1" max="16">
288
+ <div id="help-workers" class="field-help">
289
+ Number of parallel download threads. Higher values speed up the transfer when importing many small files.
290
+ For large files (100MB+), 2-4 workers is usually sufficient. Max: 16.
291
+ </div>
292
  </div>
293
  <div class="form-group">
294
+ <div class="label-row">
295
+ <label>Timeout</label>
296
+ <button type="button" class="help-toggle" data-help="help-timeout">?</button>
297
+ </div>
298
  <select id="job-timeout">
299
  <option value="1800">30 minutes</option>
300
  <option value="3600">1 hour</option>
 
302
  <option value="21600">6 hours</option>
303
  <option value="43200">12 hours</option>
304
  </select>
305
+ <div id="help-timeout" class="field-help">
306
+ Maximum time the Job is allowed to run before being automatically stopped.
307
+ Choose a value that covers your expected transfer time. For large datasets (100GB+), pick 6h or more.
308
+ You are only billed for actual runtime, not the full timeout.
309
+ </div>
310
  </div>
311
  </div>
312
 
313
  <div id="patterns-info" class="hidden">
314
+ <div class="label-row">
315
+ <label style="font-size: 13px; font-weight: 500; color: var(--text-secondary);">Import Command Preview</label>
316
+ <button type="button" class="help-toggle" data-help="help-command">?</button>
317
+ </div>
318
+ <div id="help-command" class="field-help" style="margin-top: 4px;">
319
+ This is the exact shell command that will run inside the HF Job.
320
+ It installs <code>huggingface_hub</code> with S3 support and runs <code>hf buckets import</code>
321
+ with your selected files and settings. Include/exclude patterns are auto-generated from your file selection.
322
+ </div>
323
  <div id="patterns-preview" class="patterns-preview mt-4"></div>
324
  </div>
325
 
style.css CHANGED
@@ -338,6 +338,84 @@ body {
338
  .form-group .hint {
339
  font-size: 12px;
340
  color: var(--text-muted);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  }
342
 
343
  .form-row {
 
338
  .form-group .hint {
339
  font-size: 12px;
340
  color: var(--text-muted);
341
+ line-height: 1.5;
342
+ }
343
+
344
+ /* ---- Field Help / Tooltips ---- */
345
+
346
+ .label-row {
347
+ display: flex;
348
+ align-items: center;
349
+ gap: 6px;
350
+ }
351
+
352
+ .help-toggle {
353
+ display: inline-flex;
354
+ align-items: center;
355
+ justify-content: center;
356
+ width: 16px;
357
+ height: 16px;
358
+ border-radius: 50%;
359
+ border: 1px solid var(--border);
360
+ background: transparent;
361
+ color: var(--text-muted);
362
+ font-size: 10px;
363
+ font-weight: 700;
364
+ cursor: pointer;
365
+ flex-shrink: 0;
366
+ transition: all 0.15s;
367
+ padding: 0;
368
+ line-height: 1;
369
+ font-family: var(--font-sans);
370
+ }
371
+
372
+ .help-toggle:hover {
373
+ border-color: var(--accent);
374
+ color: var(--accent);
375
+ background: var(--accent-subtle);
376
+ }
377
+
378
+ .field-help {
379
+ display: none;
380
+ font-size: 12px;
381
+ color: var(--text-secondary);
382
+ line-height: 1.6;
383
+ padding: 8px 10px;
384
+ margin-top: 2px;
385
+ background: var(--bg-secondary);
386
+ border: 1px solid var(--border);
387
+ border-radius: var(--radius-sm);
388
+ }
389
+
390
+ .field-help.visible {
391
+ display: block;
392
+ }
393
+
394
+ .field-help code {
395
+ background: var(--bg-input);
396
+ padding: 1px 5px;
397
+ border-radius: 3px;
398
+ font-family: var(--font-mono);
399
+ font-size: 11px;
400
+ }
401
+
402
+ .field-help a {
403
+ color: var(--accent);
404
+ }
405
+
406
+ .section-help {
407
+ font-size: 13px;
408
+ color: var(--text-secondary);
409
+ line-height: 1.6;
410
+ margin-bottom: 16px;
411
+ padding: 12px 14px;
412
+ background: var(--bg-secondary);
413
+ border: 1px solid var(--border);
414
+ border-radius: var(--radius);
415
+ }
416
+
417
+ .section-help a {
418
+ color: var(--accent);
419
  }
420
 
421
  .form-row {