Spaces:
Running
Running
Commit
·
9d7e455
1
Parent(s):
791fff8
♻️ Directly upload from remote file
Browse files- app.ts +7 -6
- dist/app.js +7 -6
app.ts
CHANGED
@@ -3,11 +3,11 @@ import { createRepo, commit, CommitFile, whoAmI } from "@huggingface/hub";
|
|
3 |
const c = console;
|
4 |
|
5 |
const FILES_TO_UPLOAD = [
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
];
|
12 |
|
13 |
function filenameFromURL(url: string): string {
|
@@ -62,7 +62,8 @@ window.document.addEventListener("DOMContentLoaded", () => {
|
|
62 |
return {
|
63 |
operation: "addOrUpdate",
|
64 |
path: filenameFromURL(file),
|
65 |
-
|
|
|
66 |
};
|
67 |
})
|
68 |
);
|
|
|
3 |
const c = console;
|
4 |
|
5 |
const FILES_TO_UPLOAD = [
|
6 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/model.json`,
|
7 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/group1-shard1of2`,
|
8 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/group1-shard2of2`,
|
9 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/coffee.jpg`,
|
10 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/README.md`,
|
11 |
];
|
12 |
|
13 |
function filenameFromURL(url: string): string {
|
|
|
62 |
return {
|
63 |
operation: "addOrUpdate",
|
64 |
path: filenameFromURL(file),
|
65 |
+
// upload remote file
|
66 |
+
content: new URL(file),
|
67 |
};
|
68 |
})
|
69 |
);
|
dist/app.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
import { createRepo, commit, whoAmI } from "@huggingface/hub";
|
2 |
const c = console;
|
3 |
const FILES_TO_UPLOAD = [
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
];
|
10 |
function filenameFromURL(url) {
|
11 |
return url.substring(url.lastIndexOf("/") + 1);
|
@@ -49,7 +49,8 @@ window.document.addEventListener("DOMContentLoaded", () => {
|
|
49 |
return {
|
50 |
operation: "addOrUpdate",
|
51 |
path: filenameFromURL(file),
|
52 |
-
|
|
|
53 |
};
|
54 |
}));
|
55 |
const commitOutput = await commit({
|
|
|
1 |
import { createRepo, commit, whoAmI } from "@huggingface/hub";
|
2 |
const c = console;
|
3 |
const FILES_TO_UPLOAD = [
|
4 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/model.json`,
|
5 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/group1-shard1of2`,
|
6 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/group1-shard2of2`,
|
7 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/coffee.jpg`,
|
8 |
+
`${window.location.origin}${window.location.pathname}/mobilenet/README.md`,
|
9 |
];
|
10 |
function filenameFromURL(url) {
|
11 |
return url.substring(url.lastIndexOf("/") + 1);
|
|
|
49 |
return {
|
50 |
operation: "addOrUpdate",
|
51 |
path: filenameFromURL(file),
|
52 |
+
// upload remote file
|
53 |
+
content: new URL(file),
|
54 |
};
|
55 |
}));
|
56 |
const commitOutput = await commit({
|