Spaces:
Running
Running
Commit
·
7cf7ce2
1
Parent(s):
9cc9e49
Update index.html
Browse files- index.html +14 -5
index.html
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
<input type="file" id="fileInput" multiple>
|
|
|
|
|
2 |
<button onClick="upload()">Upload</button>
|
3 |
|
4 |
-
<script>
|
5 |
-
|
6 |
|
7 |
async function upload() {
|
8 |
-
const
|
9 |
-
const
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
// Prompt the user for a unique upload path for each file
|
12 |
const filesToUpload = await Promise.all(files.map(async (file) => {
|
@@ -19,7 +26,9 @@
|
|
19 |
|
20 |
await uploadFiles({
|
21 |
repo,
|
22 |
-
credentials
|
|
|
|
|
23 |
files: filesToUpload,
|
24 |
});
|
25 |
}
|
|
|
1 |
<input type="file" id="fileInput" multiple>
|
2 |
+
<input type="text" id="repoInput" placeholder="Enter repo">
|
3 |
+
<input type="password" id="accessTokenInput" placeholder="Enter access token">
|
4 |
<button onClick="upload()">Upload</button>
|
5 |
|
6 |
+
<script type="module">
|
7 |
+
import { createRepo, uploadFiles } from "https://cdn.jsdelivr.net/npm/@huggingface/[email protected]/+esm";
|
8 |
|
9 |
async function upload() {
|
10 |
+
const fileInput = document.getElementById('fileInput');
|
11 |
+
const repoInput = document.getElementById('repoInput');
|
12 |
+
const accessTokenInput = document.getElementById('accessTokenInput');
|
13 |
+
|
14 |
+
const files = Array.from(fileInput.files); // Convert FileList to an Array
|
15 |
+
const repo = repoInput.value;
|
16 |
+
const accessToken = accessTokenInput.value;
|
17 |
|
18 |
// Prompt the user for a unique upload path for each file
|
19 |
const filesToUpload = await Promise.all(files.map(async (file) => {
|
|
|
26 |
|
27 |
await uploadFiles({
|
28 |
repo,
|
29 |
+
credentials: {
|
30 |
+
accessToken,
|
31 |
+
},
|
32 |
files: filesToUpload,
|
33 |
});
|
34 |
}
|