Add js assets (#192)

This commit is contained in:
Freddy Boulton
2025-03-19 12:19:57 -04:00
committed by GitHub
parent 103381dac2
commit 728a366924
7 changed files with 22967 additions and 1 deletions

1
.gitignore vendored
View File

@@ -9,7 +9,6 @@ __tmp/*
.mypycache
.ruff_cache
node_modules
backend/**/templates/
demo/MobileNetSSD_deploy.caffemodel
demo/MobileNetSSD_deploy.prototxt.txt
demo/scratch

View File

@@ -0,0 +1 @@
(function(){"use strict";const R="https://unpkg.com/@ffmpeg/core@0.12.6/dist/umd/ffmpeg-core.js";var E;(function(t){t.LOAD="LOAD",t.EXEC="EXEC",t.WRITE_FILE="WRITE_FILE",t.READ_FILE="READ_FILE",t.DELETE_FILE="DELETE_FILE",t.RENAME="RENAME",t.CREATE_DIR="CREATE_DIR",t.LIST_DIR="LIST_DIR",t.DELETE_DIR="DELETE_DIR",t.ERROR="ERROR",t.DOWNLOAD="DOWNLOAD",t.PROGRESS="PROGRESS",t.LOG="LOG",t.MOUNT="MOUNT",t.UNMOUNT="UNMOUNT"})(E||(E={}));const a=new Error("unknown message type"),f=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),u=new Error("failed to import ffmpeg-core.js");let r;const O=async({coreURL:t,wasmURL:n,workerURL:e})=>{const o=!r;try{t||(t=R),importScripts(t)}catch{if(t||(t=R.replace("/umd/","/esm/")),self.createFFmpegCore=(await import(t)).default,!self.createFFmpegCore)throw u}const s=t,c=n||t.replace(/.js$/g,".wasm"),b=e||t.replace(/.js$/g,".worker.js");return r=await self.createFFmpegCore({mainScriptUrlOrBlob:`${s}#${btoa(JSON.stringify({wasmURL:c,workerURL:b}))}`}),r.setLogger(i=>self.postMessage({type:E.LOG,data:i})),r.setProgress(i=>self.postMessage({type:E.PROGRESS,data:i})),o},l=({args:t,timeout:n=-1})=>{r.setTimeout(n),r.exec(...t);const e=r.ret;return r.reset(),e},m=({path:t,data:n})=>(r.FS.writeFile(t,n),!0),D=({path:t,encoding:n})=>r.FS.readFile(t,{encoding:n}),S=({path:t})=>(r.FS.unlink(t),!0),I=({oldPath:t,newPath:n})=>(r.FS.rename(t,n),!0),L=({path:t})=>(r.FS.mkdir(t),!0),N=({path:t})=>{const n=r.FS.readdir(t),e=[];for(const o of n){const s=r.FS.stat(`${t}/${o}`),c=r.FS.isDir(s.mode);e.push({name:o,isDir:c})}return e},A=({path:t})=>(r.FS.rmdir(t),!0),w=({fsType:t,options:n,mountPoint:e})=>{const o=t,s=r.FS.filesystems[o];return s?(r.FS.mount(s,n,e),!0):!1},k=({mountPoint:t})=>(r.FS.unmount(t),!0);self.onmessage=async({data:{id:t,type:n,data:e}})=>{const o=[];let s;try{if(n!==E.LOAD&&!r)throw f;switch(n){case E.LOAD:s=await O(e);break;case E.EXEC:s=l(e);break;case E.WRITE_FILE:s=m(e);break;case E.READ_FILE:s=D(e);break;case E.DELETE_FILE:s=S(e);break;case E.RENAME:s=I(e);break;case E.CREATE_DIR:s=L(e);break;case E.LIST_DIR:s=N(e);break;case E.DELETE_DIR:s=A(e);break;case E.MOUNT:s=w(e);break;case E.UNMOUNT:s=k(e);break;default:throw a}}catch(c){self.postMessage({id:t,type:E.ERROR,data:c.toString()});return}s instanceof Uint8Array&&o.push(s.buffer),self.postMessage({id:t,type:n,data:s},o)}})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
(function(){"use strict";const R="https://unpkg.com/@ffmpeg/core@0.12.6/dist/umd/ffmpeg-core.js";var E;(function(t){t.LOAD="LOAD",t.EXEC="EXEC",t.WRITE_FILE="WRITE_FILE",t.READ_FILE="READ_FILE",t.DELETE_FILE="DELETE_FILE",t.RENAME="RENAME",t.CREATE_DIR="CREATE_DIR",t.LIST_DIR="LIST_DIR",t.DELETE_DIR="DELETE_DIR",t.ERROR="ERROR",t.DOWNLOAD="DOWNLOAD",t.PROGRESS="PROGRESS",t.LOG="LOG",t.MOUNT="MOUNT",t.UNMOUNT="UNMOUNT"})(E||(E={}));const a=new Error("unknown message type"),f=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),u=new Error("failed to import ffmpeg-core.js");let r;const O=async({coreURL:t,wasmURL:n,workerURL:e})=>{const o=!r;try{t||(t=R),importScripts(t)}catch{if(t||(t=R.replace("/umd/","/esm/")),self.createFFmpegCore=(await import(t)).default,!self.createFFmpegCore)throw u}const s=t,c=n||t.replace(/.js$/g,".wasm"),b=e||t.replace(/.js$/g,".worker.js");return r=await self.createFFmpegCore({mainScriptUrlOrBlob:`${s}#${btoa(JSON.stringify({wasmURL:c,workerURL:b}))}`}),r.setLogger(i=>self.postMessage({type:E.LOG,data:i})),r.setProgress(i=>self.postMessage({type:E.PROGRESS,data:i})),o},l=({args:t,timeout:n=-1})=>{r.setTimeout(n),r.exec(...t);const e=r.ret;return r.reset(),e},m=({path:t,data:n})=>(r.FS.writeFile(t,n),!0),D=({path:t,encoding:n})=>r.FS.readFile(t,{encoding:n}),S=({path:t})=>(r.FS.unlink(t),!0),I=({oldPath:t,newPath:n})=>(r.FS.rename(t,n),!0),L=({path:t})=>(r.FS.mkdir(t),!0),N=({path:t})=>{const n=r.FS.readdir(t),e=[];for(const o of n){const s=r.FS.stat(`${t}/${o}`),c=r.FS.isDir(s.mode);e.push({name:o,isDir:c})}return e},A=({path:t})=>(r.FS.rmdir(t),!0),w=({fsType:t,options:n,mountPoint:e})=>{const o=t,s=r.FS.filesystems[o];return s?(r.FS.mount(s,n,e),!0):!1},k=({mountPoint:t})=>(r.FS.unmount(t),!0);self.onmessage=async({data:{id:t,type:n,data:e}})=>{const o=[];let s;try{if(n!==E.LOAD&&!r)throw f;switch(n){case E.LOAD:s=await O(e);break;case E.EXEC:s=l(e);break;case E.WRITE_FILE:s=m(e);break;case E.READ_FILE:s=D(e);break;case E.DELETE_FILE:s=S(e);break;case E.RENAME:s=I(e);break;case E.CREATE_DIR:s=L(e);break;case E.LIST_DIR:s=N(e);break;case E.DELETE_DIR:s=A(e);break;case E.MOUNT:s=w(e);break;case E.UNMOUNT:s=k(e);break;default:throw a}}catch(c){self.postMessage({id:t,type:E.ERROR,data:c.toString()});return}s instanceof Uint8Array&&o.push(s.buffer),self.postMessage({id:t,type:n,data:s},o)}})();

View File

@@ -0,0 +1,222 @@
var v;
(function(e) {
e.LOAD = "LOAD", e.EXEC = "EXEC", e.WRITE_FILE = "WRITE_FILE", e.READ_FILE = "READ_FILE", e.DELETE_FILE = "DELETE_FILE", e.RENAME = "RENAME", e.CREATE_DIR = "CREATE_DIR", e.LIST_DIR = "LIST_DIR", e.DELETE_DIR = "DELETE_DIR", e.ERROR = "ERROR", e.DOWNLOAD = "DOWNLOAD", e.PROGRESS = "PROGRESS", e.LOG = "LOG", e.MOUNT = "MOUNT", e.UNMOUNT = "UNMOUNT";
})(v || (v = {}));
const {
SvelteComponent: X,
append_hydration: T,
attr: I,
binding_callbacks: j,
children: A,
claim_element: N,
claim_text: Q,
detach: a,
element: k,
empty: b,
init: z,
insert_hydration: O,
is_function: p,
listen: L,
noop: y,
run_all: B,
safe_not_equal: H,
set_data: Y,
src_url_equal: w,
text: Z,
toggle_class: d
} = window.__gradio__svelte__internal;
function S(e) {
let l;
function t(u, i) {
return J;
}
let o = t()(e);
return {
c() {
o.c(), l = b();
},
l(u) {
o.l(u), l = b();
},
m(u, i) {
o.m(u, i), O(u, l, i);
},
p(u, i) {
o.p(u, i);
},
d(u) {
u && a(l), o.d(u);
}
};
}
function J(e) {
let l, t, n, o, u;
return {
c() {
l = k("div"), t = k("video"), this.h();
},
l(i) {
l = N(i, "DIV", { class: !0 });
var c = A(l);
t = N(c, "VIDEO", { src: !0 }), A(t).forEach(a), c.forEach(a), this.h();
},
h() {
var i;
w(t.src, n = /*value*/
(i = e[2]) == null ? void 0 : i.video.url) || I(t, "src", n), I(l, "class", "container svelte-1uoo7dd"), d(
l,
"table",
/*type*/
e[0] === "table"
), d(
l,
"gallery",
/*type*/
e[0] === "gallery"
), d(
l,
"selected",
/*selected*/
e[1]
);
},
m(i, c) {
O(i, l, c), T(l, t), e[6](t), o || (u = [
L(
t,
"loadeddata",
/*init*/
e[4]
),
L(t, "mouseover", function() {
p(
/*video*/
e[3].play.bind(
/*video*/
e[3]
)
) && e[3].play.bind(
/*video*/
e[3]
).apply(this, arguments);
}),
L(t, "mouseout", function() {
p(
/*video*/
e[3].pause.bind(
/*video*/
e[3]
)
) && e[3].pause.bind(
/*video*/
e[3]
).apply(this, arguments);
})
], o = !0);
},
p(i, c) {
var _;
e = i, c & /*value*/
4 && !w(t.src, n = /*value*/
(_ = e[2]) == null ? void 0 : _.video.url) && I(t, "src", n), c & /*type*/
1 && d(
l,
"table",
/*type*/
e[0] === "table"
), c & /*type*/
1 && d(
l,
"gallery",
/*type*/
e[0] === "gallery"
), c & /*selected*/
2 && d(
l,
"selected",
/*selected*/
e[1]
);
},
d(i) {
i && a(l), e[6](null), o = !1, B(u);
}
};
}
function K(e) {
let l, t = (
/*value*/
e[2] && S(e)
);
return {
c() {
t && t.c(), l = b();
},
l(n) {
t && t.l(n), l = b();
},
m(n, o) {
t && t.m(n, o), O(n, l, o);
},
p(n, [o]) {
/*value*/
n[2] ? t ? t.p(n, o) : (t = S(n), t.c(), t.m(l.parentNode, l)) : t && (t.d(1), t = null);
},
i: y,
o: y,
d(n) {
n && a(l), t && t.d(n);
}
};
}
function P(e, l, t) {
var n = this && this.__awaiter || function(f, G, s, R) {
function W(E) {
return E instanceof s ? E : new s(function(m) {
m(E);
});
}
return new (s || (s = Promise))(function(E, m) {
function q(r) {
try {
h(R.next(r));
} catch (D) {
m(D);
}
}
function V(r) {
try {
h(R.throw(r));
} catch (D) {
m(D);
}
}
function h(r) {
r.done ? E(r.value) : W(r.value).then(q, V);
}
h((R = R.apply(f, G || [])).next());
});
};
let { type: o } = l, { selected: u = !1 } = l, { value: i } = l, { loop: c } = l, _;
function U() {
return n(this, void 0, void 0, function* () {
t(3, _.muted = !0, _), t(3, _.playsInline = !0, _), t(3, _.controls = !1, _), _.setAttribute("muted", ""), yield _.play(), _.pause();
});
}
function C(f) {
j[f ? "unshift" : "push"](() => {
_ = f, t(3, _);
});
}
return e.$$set = (f) => {
"type" in f && t(0, o = f.type), "selected" in f && t(1, u = f.selected), "value" in f && t(2, i = f.value), "loop" in f && t(5, c = f.loop);
}, [o, u, i, _, U, c, C];
}
class M extends X {
constructor(l) {
super(), z(this, l, P, K, H, { type: 0, selected: 1, value: 2, loop: 5 });
}
}
export {
M as default
};

View File

@@ -0,0 +1 @@
.container.svelte-1uoo7dd{flex:none;max-width:none}.container.svelte-1uoo7dd video{width:var(--size-full);height:var(--size-full);object-fit:cover}.container.svelte-1uoo7dd:hover,.container.selected.svelte-1uoo7dd{border-color:var(--border-color-accent)}.container.table.svelte-1uoo7dd{margin:0 auto;border:2px solid var(--border-color-primary);border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-1uoo7dd{height:var(--size-20);max-height:var(--size-20);object-fit:cover}