julien-c HF staff commited on
Commit
d9624d5
1 Parent(s): 58b5d51

Fix relative paths

Browse files
Files changed (5) hide show
  1. README.md +2 -32
  2. build/bundle.css +1 -1
  3. build/bundle.js +1 -1
  4. build/bundle.js.map +0 -0
  5. index.html +4 -4
README.md CHANGED
@@ -1,37 +1,7 @@
1
  ---
2
  title: Huggingfab
3
- emoji: 🏢
4
  colorFrom: gray
5
  colorTo: gray
6
- sdk: streamlit
7
- app_file: app.py
8
- pinned: false
9
  ---
10
-
11
- # Configuration
12
-
13
- `title`: _string_
14
- Display title for the Space
15
-
16
- `emoji`: _string_
17
- Space emoji (emoji-only character allowed)
18
-
19
- `colorFrom`: _string_
20
- Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
-
22
- `colorTo`: _string_
23
- Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
-
25
- `sdk`: _string_
26
- Can be either `gradio` or `streamlit`
27
-
28
- `sdk_version` : _string_
29
- Only applicable for `streamlit` SDK.
30
- See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
31
-
32
- `app_file`: _string_
33
- Path to your main application file (which contains either `gradio` or `streamlit` Python code).
34
- Path is relative to the root of the repository.
35
-
36
- `pinned`: _boolean_
37
- Whether the Space stays on top of your list.
1
  ---
2
  title: Huggingfab
3
+ emoji: 🦊
4
  colorFrom: gray
5
  colorTo: gray
6
+ sdk: static
 
 
7
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
build/bundle.css CHANGED
@@ -1 +1 @@
1
- .container.svelte-19le2fc{display:flex;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}.popup.svelte-19le2fc{background:#FFF;max-width:75%;padding:30px 60px}.hf.svelte-19le2fc{width:65px;margin-right:8px}.sketchfab.svelte-19le2fc{margin-left:8px;width:60px}.plus.svelte-19le2fc{font-size:48px;position:relative;top:-10px}p.svelte-19le2fc{font-family:'Courier New', Courier, monospace}.subtitle.svelte-19le2fc{font-size:24px}.desc.svelte-19le2fc{font-size:18px}.button.svelte-19le2fc{margin-top:20px;padding:16px}.button.svelte-19le2fc:hover{background-color:#1CAAD9;color:#F2F2F2;border:1px solid #1CAAD9}.button.svelte-19le2fc:active{background-color:orange;border:1px solid orange}.container.svelte-14yhi0m{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.viewer.svelte-14yhi0m{width:100%;height:100%;opacity:0;visibility:hidden}.started.svelte-14yhi0m{visibility:visible;opacity:1;transition:opacity 2s}.loader.svelte-14yhi0m{display:none;position:absolute;width:180px;margin-left:20px;padding:60px;border-radius:10px;text-align:center;font-size:24px;font-family:'Courier New', Courier, monospace}.loading-logo.svelte-14yhi0m,.loading-logo-grayscale.svelte-14yhi0m{background:url(/huggingface.svg) center center no-repeat;margin-left:30px;height:120px;width:120px}.loading-logo.svelte-14yhi0m{position:absolute;bottom:103px;height:0px;background-position-y:bottom;transition:height 0.3s}.loading-logo-grayscale.svelte-14yhi0m{filter:grayscale(1)}.loading.svelte-14yhi0m{display:block}.form.svelte-14yhi0m{position:absolute;bottom:10%;left:25%;width:50%;margin:0;padding:0}.query.svelte-14yhi0m{font-size:25px;margin:0;width:100%;box-shadow:#666 0px 0px 10px;border:1px solid #1CAAD9;border-radius:4px;color:#333}
1
+ .container.svelte-1nu4cza{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.viewer.svelte-1nu4cza{width:100%;height:100%;opacity:0;visibility:hidden}.started.svelte-1nu4cza{visibility:visible;opacity:1;transition:opacity 2s}.loader.svelte-1nu4cza{display:none;position:absolute;width:180px;margin-left:20px;padding:60px;border-radius:10px;text-align:center;font-size:24px;font-family:'Courier New', Courier, monospace}.loading-logo.svelte-1nu4cza,.loading-logo-grayscale.svelte-1nu4cza{background:url(../huggingface.svg) center center no-repeat;margin-left:30px;height:120px;width:120px}.loading-logo.svelte-1nu4cza{position:absolute;bottom:103px;height:0px;background-position-y:bottom;transition:height 0.3s}.loading-logo-grayscale.svelte-1nu4cza{filter:grayscale(1)}.loading.svelte-1nu4cza{display:block}.form.svelte-1nu4cza{position:absolute;bottom:10%;left:25%;width:50%;margin:0;padding:0}.query.svelte-1nu4cza{font-size:25px;margin:0;width:100%;box-shadow:#666 0px 0px 10px;border:1px solid #1CAAD9;border-radius:4px;color:#333}.container.svelte-19le2fc{display:flex;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}.popup.svelte-19le2fc{background:#FFF;max-width:75%;padding:30px 60px}.hf.svelte-19le2fc{width:65px;margin-right:8px}.sketchfab.svelte-19le2fc{margin-left:8px;width:60px}.plus.svelte-19le2fc{font-size:48px;position:relative;top:-10px}p.svelte-19le2fc{font-family:'Courier New', Courier, monospace}.subtitle.svelte-19le2fc{font-size:24px}.desc.svelte-19le2fc{font-size:18px}.button.svelte-19le2fc{margin-top:20px;padding:16px}.button.svelte-19le2fc:hover{background-color:#1CAAD9;color:#F2F2F2;border:1px solid #1CAAD9}.button.svelte-19le2fc:active{background-color:orange;border:1px solid orange}
build/bundle.js CHANGED
@@ -1,2 +1,2 @@
1
- var app=function(){"use strict";function t(){}const e=t=>t;function n(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(n)}function s(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let i;function l(t,e){return i||(i=document.createElement("a")),i.href=e,t===i.href}const u="undefined"!=typeof window;let a=u?()=>window.performance.now():()=>Date.now(),f=u?t=>requestAnimationFrame(t):t;const d=new Set;function p(t){d.forEach((e=>{e.c(t)||(d.delete(e),e.f())})),0!==d.size&&f(p)}function m(t,e){t.appendChild(e)}function h(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function g(t){const e=b("style");return function(t,e){m(t.head||t,e)}(h(t),e),e}function $(t,e,n){t.insertBefore(e,n||null)}function v(t){t.parentNode.removeChild(t)}function b(t){return document.createElement(t)}function y(t){return document.createTextNode(t)}function _(){return y(" ")}function w(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function x(t){return function(e){return e.preventDefault(),t.call(this,e)}}function k(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function E(t,e){t.value=null==e?"":e}function A(t,e,n,o){t.style.setProperty(e,n,o?"important":"")}function C(t,e,n){t.classList[n?"add":"remove"](e)}const L=new Set;let D,S=0;function R(t,e,n,o,r,s,c,i=0){const l=16.666/o;let u="{\n";for(let t=0;t<=1;t+=l){const o=e+(n-e)*s(t);u+=100*t+`%{${c(o,1-o)}}\n`}const a=u+`100% {${c(n,1-n)}}\n}`,f=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(a)}_${i}`,d=h(t);L.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=g(t).sheet),m=d.__svelte_rules||(d.__svelte_rules={});m[f]||(m[f]=!0,p.insertRule(`@keyframes ${f} ${a}`,p.cssRules.length));const $=t.style.animation||"";return t.style.animation=`${$?`${$}, `:""}${f} ${o}ms linear ${r}ms 1 both`,S+=1,f}function N(t,e){const n=(t.style.animation||"").split(", "),o=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),r=n.length-o.length;r&&(t.style.animation=o.join(", "),S-=r,S||f((()=>{S||(L.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),L.clear())})))}function O(t){D=t}function P(t){(function(){if(!D)throw new Error("Function called outside component initialization");return D})().$$.on_mount.push(t)}const T=[],j=[],F=[],M=[],U=Promise.resolve();let z=!1;function q(t){F.push(t)}let H=!1;const I=new Set;function B(){if(!H){H=!0;do{for(let t=0;t<T.length;t+=1){const e=T[t];O(e),G(e.$$)}for(O(null),T.length=0;j.length;)j.pop()();for(let t=0;t<F.length;t+=1){const e=F[t];I.has(e)||(I.add(e),e())}F.length=0}while(T.length);for(;M.length;)M.pop()();z=!1,H=!1,I.clear()}}function G(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(q)}}let J;function W(t,e,n){t.dispatchEvent(function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(`${e?"intro":"outro"}${n}`))}const K=new Set;let Q;function V(){Q={r:0,c:[],p:Q}}function X(){Q.r||r(Q.c),Q=Q.p}function Y(t,e){t&&t.i&&(K.delete(t),t.i(e))}function Z(t,e,n,o){if(t&&t.o){if(K.has(t))return;K.add(t),Q.c.push((()=>{K.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const tt={duration:0};function et(n,o,c,i){let l=o(n,c),u=i?0:1,m=null,h=null,g=null;function $(){g&&N(n,g)}function v(t,e){const n=t.b-u;return e*=Math.abs(n),{a:u,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function b(o){const{delay:s=0,duration:c=300,easing:i=e,tick:b=t,css:y}=l||tt,_={start:a()+s,b:o};o||(_.group=Q,Q.r+=1),m||h?h=_:(y&&($(),g=R(n,u,o,c,s,i,y)),o&&b(0,1),m=v(_,c),q((()=>W(n,o,"start"))),function(t){let e;0===d.size&&f(p),new Promise((n=>{d.add(e={c:t,f:n})}))}((t=>{if(h&&t>h.start&&(m=v(h,c),h=null,W(n,m.b,"start"),y&&($(),g=R(n,u,m.b,m.duration,0,i,l.css))),m)if(t>=m.end)b(u=m.b,1-u),W(n,m.b,"end"),h||(m.b?$():--m.group.r||r(m.group.c)),m=null;else if(t>=m.start){const e=t-m.start;u=m.a+m.d*i(e/m.duration),b(u,1-u)}return!(!m&&!h)})))}return{run(t){s(l)?(J||(J=Promise.resolve(),J.then((()=>{J=null}))),J).then((()=>{l=l(),b(t)})):b(t)},end(){$(),m=h=null}}}function nt(t){t&&t.c()}function ot(t,e,o,c){const{fragment:i,on_mount:l,on_destroy:u,after_update:a}=t.$$;i&&i.m(e,o),c||q((()=>{const e=l.map(n).filter(s);u?u.push(...e):r(e),t.$$.on_mount=[]})),a.forEach(q)}function rt(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function st(t,e){-1===t.$$.dirty[0]&&(T.push(t),z||(z=!0,U.then(B)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ct(e,n,s,c,i,l,u,a=[-1]){const f=D;O(e);const d=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:i,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(f?f.$$.context:[])),callbacks:o(),dirty:a,skip_bound:!1,root:n.target||f.$$.root};u&&u(d.root);let p=!1;if(d.ctx=s?s(e,n.props||{},((t,n,...o)=>{const r=o.length?o[0]:n;return d.ctx&&i(d.ctx[t],d.ctx[t]=r)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](r),p&&st(e,t)),n})):[],d.update(),p=!0,r(d.before_update),d.fragment=!!c&&c(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(v)}else d.fragment&&d.fragment.c();n.intro&&Y(e.$$.fragment),ot(e,n.target,n.anchor,n.customElement),B()}O(f)}class it{$destroy(){rt(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function lt(t,{delay:n=0,duration:o=400,easing:r=e}={}){const s=+getComputedStyle(t).opacity;return{delay:n,duration:o,easing:r,css:t=>"opacity: "+t*s}}function ut(e){let n,o,r,s,c,i,u,a,f,d,p,h,g,y,E,A,C;return{c(){n=b("div"),o=b("div"),r=b("img"),c=_(),i=b("span"),i.textContent="+",u=_(),a=b("img"),d=_(),p=b("p"),p.innerHTML='A <span class="sketchfab svelte-19le2fc">Sketchfab</span> + <span class="huggingface">Huggingface</span> experiment',h=_(),g=b("p"),g.textContent="This demo uses the Huggingface inference API to trigger animations on a Sketchfab model.",y=_(),E=b("button"),E.textContent="Let's Go !",k(r,"class","hf svelte-19le2fc"),l(r.src,s="/huggingface.svg")||k(r,"src","/huggingface.svg"),k(i,"class","plus svelte-19le2fc"),k(a,"class","sketchfab svelte-19le2fc"),l(a.src,f="/sketchfab-logo.svg")||k(a,"src","/sketchfab-logo.svg"),k(p,"class","subtitle svelte-19le2fc"),k(g,"class","desc svelte-19le2fc"),k(E,"class","button svelte-19le2fc"),k(o,"class","popup svelte-19le2fc"),k(n,"class","container svelte-19le2fc")},m(t,s){$(t,n,s),m(n,o),m(o,r),m(o,c),m(o,i),m(o,u),m(o,a),m(o,d),m(o,p),m(o,h),m(o,g),m(o,y),m(o,E),A||(C=w(E,"click",x(e[0])),A=!0)},p:t,i:t,o:t,d(t){t&&v(n),A=!1,C()}}}function at(t,e,n){let{introDone:o=!1}=e;return t.$$set=t=>{"introDone"in t&&n(1,o=t.introDone)},[function(){n(1,o=!0)},o]}class ft extends it{constructor(t){super(),ct(this,t,at,ut,c,{introDone:1})}}function dt(t){let e,n,o,r,s,c,i,l,u,a,f,d=Math.floor(100*t[0])+"";return{c(){e=b("div"),n=b("div"),o=_(),r=b("div"),s=_(),c=b("div"),i=y("Loading "),l=y(d),u=y("%"),k(n,"class","loading-logo-grayscale svelte-14yhi0m"),k(r,"class","loading-logo svelte-14yhi0m"),A(r,"height",100*t[0]+"px"),k(e,"class","loader svelte-14yhi0m"),C(e,"loading",!t[3])},m(t,a){$(t,e,a),m(e,n),m(e,o),m(e,r),m(e,s),m(e,c),m(c,i),m(c,l),m(c,u),f=!0},p(t,n){(!f||1&n)&&A(r,"height",100*t[0]+"px"),(!f||1&n)&&d!==(d=Math.floor(100*t[0])+"")&&function(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}(l,d),8&n&&C(e,"loading",!t[3])},i(t){f||(q((()=>{a||(a=et(e,lt,{},!0)),a.run(1)})),f=!0)},o(t){a||(a=et(e,lt,{},!1)),a.run(0),f=!1},d(t){t&&v(e),t&&a&&a.end()}}}function pt(t){let e,n,o,s,c,i;return{c(){e=b("form"),n=b("input"),k(n,"class","query svelte-14yhi0m"),k(n,"placeholder","Tell me what to do and press enter !"),k(n,"autocomplete",""),n.autofocus=!0,k(e,"class","form svelte-14yhi0m")},m(o,r){$(o,e,r),m(e,n),E(n,t[2]),s=!0,n.focus(),c||(i=[w(n,"input",t[7]),w(e,"submit",x(t[4]))],c=!0)},p(t,e){4&e&&n.value!==t[2]&&E(n,t[2])},i(t){s||(q((()=>{o||(o=et(e,lt,{duration:300},!0)),o.run(1)})),s=!0)},o(t){o||(o=et(e,lt,{duration:300},!1)),o.run(0),s=!1},d(t){t&&v(e),t&&o&&o.end(),c=!1,r(i)}}}function mt(t){let e,n,o,r,s,c,i=!t[3]&&dt(t),u=t[3]&&pt(t);return{c(){e=b("div"),i&&i.c(),n=_(),o=b("iframe"),s=_(),u&&u.c(),k(o,"title","Forest Animal: Fox"),k(o,"frameborder","0"),o.allowFullscreen="true",k(o,"mozallowfullscreen","true"),k(o,"webkitallowfullscreen","true"),k(o,"allow","autoplay; fullscreen; xr-spatial-tracking"),k(o,"xr-spatial-tracking","true"),k(o,"execution-while-out-of-viewport","true"),k(o,"execution-while-not-rendered","true"),k(o,"web-share","true"),l(o.src,r="")||k(o,"src",""),k(o,"class","svelte-14yhi0m"),C(o,"viewer",t[1]),C(o,"started",t[3]),k(e,"class","container svelte-14yhi0m")},m(r,l){$(r,e,l),i&&i.m(e,null),m(e,n),m(e,o),t[6](o),m(e,s),u&&u.m(e,null),c=!0},p(t,[r]){t[3]?i&&(V(),Z(i,1,1,(()=>{i=null})),X()):i?(i.p(t,r),8&r&&Y(i,1)):(i=dt(t),i.c(),Y(i,1),i.m(e,n)),2&r&&C(o,"viewer",t[1]),8&r&&C(o,"started",t[3]),t[3]?u?(u.p(t,r),8&r&&Y(u,1)):(u=pt(t),u.c(),Y(u,1),u.m(e,null)):u&&(V(),Z(u,1,1,(()=>{u=null})),X())},i(t){c||(Y(i),Y(u),c=!0)},o(t){Z(i),Z(u),c=!1},d(n){n&&v(e),i&&i.d(),t[6](null),u&&u.d()}}}function ht(t,e,n){let o,r,s,{modelUid:c="abf5788c354f4d4b9ff5ea1fd10c6496"}=e,i=0,l=!1;l=!0;let u,a="";return P((()=>{s=new Sketchfab(r),s.init(c,{success:t=>{s=t,s.start(),s.addEventListener("modelLoadProgress",(function(t){n(0,i=t.progress)})),s.addEventListener("viewerready",(function(){s.getAnimations((function(t,e){u=e.filter((t=>{const e=t[1];return"Walk"!==e&&"Roll"!==e&&"Run"!==e&&"Land"!==e&&"Idle_2"!==e}))}))}))}})})),t.$$set=t=>{"modelUid"in t&&n(5,c=t.modelUid)},t.$$.update=()=>{1&t.$$.dirty&&n(3,o=i>=1)},[i,r,a,o,async function(){const t=await fetch("https://api-inference.huggingface.co/models/facebook/bart-large-mnli",{method:"POST",body:JSON.stringify({inputs:(e=a,e.trim().toLowerCase()),parameters:{candidate_labels:u.map((t=>t[1].replaceAll("_"," ")))}})});var e;let o=(await t.json()).labels[0];for(const t of u)if(t[1].replaceAll("_"," ").toLowerCase()===o.trim().toLowerCase()){const e=t[0];s.setCurrentAnimationByUID(e)}n(2,a="")},c,function(t){j[t?"unshift":"push"]((()=>{r=t,n(1,r)}))},function(){a=this.value,n(2,a)}]}class gt extends it{constructor(t){super(),ct(this,t,ht,mt,c,{modelUid:5})}}function $t(t){let e,n,o;function r(e){t[1](e)}let s={};return void 0!==t[0]&&(s.introDone=t[0]),e=new ft({props:s}),j.push((()=>function(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))}(e,"introDone",r))),{c(){nt(e.$$.fragment)},m(t,n){ot(e,t,n),o=!0},p(t,o){const r={};var s;!n&&1&o&&(n=!0,r.introDone=t[0],s=()=>n=!1,M.push(s)),e.$set(r)},i(t){o||(Y(e.$$.fragment,t),o=!0)},o(t){Z(e.$$.fragment,t),o=!1},d(t){rt(e,t)}}}function vt(e){let n,o;return n=new gt({}),{c(){nt(n.$$.fragment)},m(t,e){ot(n,t,e),o=!0},p:t,i(t){o||(Y(n.$$.fragment,t),o=!0)},o(t){Z(n.$$.fragment,t),o=!1},d(t){rt(n,t)}}}function bt(t){let e,n,o,r;const s=[vt,$t],c=[];function i(t,e){return t[0]?0:1}return e=i(t),n=c[e]=s[e](t),{c(){n.c(),o=y("")},m(t,n){c[e].m(t,n),$(t,o,n),r=!0},p(t,[r]){let l=e;e=i(t),e===l?c[e].p(t,r):(V(),Z(c[l],1,1,(()=>{c[l]=null})),X(),n=c[e],n?n.p(t,r):(n=c[e]=s[e](t),n.c()),Y(n,1),n.m(o.parentNode,o))},i(t){r||(Y(n),r=!0)},o(t){Z(n),r=!1},d(t){c[e].d(t),t&&v(o)}}}function yt(t,e,n){let o=!1;return[o,function(t){o=t,n(0,o)}]}return new class extends it{constructor(t){super(),ct(this,t,yt,bt,c,{})}}({target:document.body,props:{}})}();
2
  //# sourceMappingURL=bundle.js.map
1
+ var app=function(){"use strict";function t(){}const e=t=>t;function n(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(n)}function s(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let i;function l(t,e){return i||(i=document.createElement("a")),i.href=e,t===i.href}const u="undefined"!=typeof window;let a=u?()=>window.performance.now():()=>Date.now(),f=u?t=>requestAnimationFrame(t):t;const d=new Set;function p(t){d.forEach((e=>{e.c(t)||(d.delete(e),e.f())})),0!==d.size&&f(p)}function m(t,e){t.appendChild(e)}function g(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function h(t){const e=b("style");return function(t,e){m(t.head||t,e)}(g(t),e),e}function $(t,e,n){t.insertBefore(e,n||null)}function v(t){t.parentNode.removeChild(t)}function b(t){return document.createElement(t)}function _(t){return document.createTextNode(t)}function y(){return _(" ")}function w(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function x(t){return function(e){return e.preventDefault(),t.call(this,e)}}function k(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function E(t,e){t.value=null==e?"":e}function A(t,e,n,o){t.style.setProperty(e,n,o?"important":"")}function C(t,e,n){t.classList[n?"add":"remove"](e)}const L=new Set;let D,z=0;function S(t,e,n,o,r,s,c,i=0){const l=16.666/o;let u="{\n";for(let t=0;t<=1;t+=l){const o=e+(n-e)*s(t);u+=100*t+`%{${c(o,1-o)}}\n`}const a=u+`100% {${c(n,1-n)}}\n}`,f=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(a)}_${i}`,d=g(t);L.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=h(t).sheet),m=d.__svelte_rules||(d.__svelte_rules={});m[f]||(m[f]=!0,p.insertRule(`@keyframes ${f} ${a}`,p.cssRules.length));const $=t.style.animation||"";return t.style.animation=`${$?`${$}, `:""}${f} ${o}ms linear ${r}ms 1 both`,z+=1,f}function R(t,e){const n=(t.style.animation||"").split(", "),o=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),r=n.length-o.length;r&&(t.style.animation=o.join(", "),z-=r,z||f((()=>{z||(L.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),L.clear())})))}function N(t){D=t}function O(t){(function(){if(!D)throw new Error("Function called outside component initialization");return D})().$$.on_mount.push(t)}const P=[],T=[],j=[],F=[],M=Promise.resolve();let U=!1;function q(t){j.push(t)}let H=!1;const I=new Set;function B(){if(!H){H=!0;do{for(let t=0;t<P.length;t+=1){const e=P[t];N(e),G(e.$$)}for(N(null),P.length=0;T.length;)T.pop()();for(let t=0;t<j.length;t+=1){const e=j[t];I.has(e)||(I.add(e),e())}j.length=0}while(P.length);for(;F.length;)F.pop()();U=!1,H=!1,I.clear()}}function G(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(q)}}let J;function W(t,e,n){t.dispatchEvent(function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(`${e?"intro":"outro"}${n}`))}const K=new Set;let Q;function V(){Q={r:0,c:[],p:Q}}function X(){Q.r||r(Q.c),Q=Q.p}function Y(t,e){t&&t.i&&(K.delete(t),t.i(e))}function Z(t,e,n,o){if(t&&t.o){if(K.has(t))return;K.add(t),Q.c.push((()=>{K.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const tt={duration:0};function et(n,o,c,i){let l=o(n,c),u=i?0:1,m=null,g=null,h=null;function $(){h&&R(n,h)}function v(t,e){const n=t.b-u;return e*=Math.abs(n),{a:u,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function b(o){const{delay:s=0,duration:c=300,easing:i=e,tick:b=t,css:_}=l||tt,y={start:a()+s,b:o};o||(y.group=Q,Q.r+=1),m||g?g=y:(_&&($(),h=S(n,u,o,c,s,i,_)),o&&b(0,1),m=v(y,c),q((()=>W(n,o,"start"))),function(t){let e;0===d.size&&f(p),new Promise((n=>{d.add(e={c:t,f:n})}))}((t=>{if(g&&t>g.start&&(m=v(g,c),g=null,W(n,m.b,"start"),_&&($(),h=S(n,u,m.b,m.duration,0,i,l.css))),m)if(t>=m.end)b(u=m.b,1-u),W(n,m.b,"end"),g||(m.b?$():--m.group.r||r(m.group.c)),m=null;else if(t>=m.start){const e=t-m.start;u=m.a+m.d*i(e/m.duration),b(u,1-u)}return!(!m&&!g)})))}return{run(t){s(l)?(J||(J=Promise.resolve(),J.then((()=>{J=null}))),J).then((()=>{l=l(),b(t)})):b(t)},end(){$(),m=g=null}}}function nt(t){t&&t.c()}function ot(t,e,o,c){const{fragment:i,on_mount:l,on_destroy:u,after_update:a}=t.$$;i&&i.m(e,o),c||q((()=>{const e=l.map(n).filter(s);u?u.push(...e):r(e),t.$$.on_mount=[]})),a.forEach(q)}function rt(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function st(t,e){-1===t.$$.dirty[0]&&(P.push(t),U||(U=!0,M.then(B)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ct(e,n,s,c,i,l,u,a=[-1]){const f=D;N(e);const d=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:i,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(f?f.$$.context:[])),callbacks:o(),dirty:a,skip_bound:!1,root:n.target||f.$$.root};u&&u(d.root);let p=!1;if(d.ctx=s?s(e,n.props||{},((t,n,...o)=>{const r=o.length?o[0]:n;return d.ctx&&i(d.ctx[t],d.ctx[t]=r)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](r),p&&st(e,t)),n})):[],d.update(),p=!0,r(d.before_update),d.fragment=!!c&&c(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(v)}else d.fragment&&d.fragment.c();n.intro&&Y(e.$$.fragment),ot(e,n.target,n.anchor,n.customElement),B()}N(f)}class it{$destroy(){rt(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function lt(t,{delay:n=0,duration:o=400,easing:r=e}={}){const s=+getComputedStyle(t).opacity;return{delay:n,duration:o,easing:r,css:t=>"opacity: "+t*s}}function ut(e){let n,o,r,s,c,i,u,a,f,d,p,g,h,_,E,A,C;return{c(){n=b("div"),o=b("div"),r=b("img"),c=y(),i=b("span"),i.textContent="+",u=y(),a=b("img"),d=y(),p=b("p"),p.innerHTML='A <span class="sketchfab svelte-19le2fc">Sketchfab</span> + <span class="huggingface">Huggingface</span> experiment',g=y(),h=b("p"),h.textContent="This demo uses the Huggingface inference API to trigger animations on a Sketchfab model.",_=y(),E=b("button"),E.textContent="Let's Go !",k(r,"class","hf svelte-19le2fc"),l(r.src,s="./huggingface.svg")||k(r,"src","./huggingface.svg"),k(i,"class","plus svelte-19le2fc"),k(a,"class","sketchfab svelte-19le2fc"),l(a.src,f="./sketchfab-logo.svg")||k(a,"src","./sketchfab-logo.svg"),k(p,"class","subtitle svelte-19le2fc"),k(h,"class","desc svelte-19le2fc"),k(E,"class","button svelte-19le2fc"),k(o,"class","popup svelte-19le2fc"),k(n,"class","container svelte-19le2fc")},m(t,s){$(t,n,s),m(n,o),m(o,r),m(o,c),m(o,i),m(o,u),m(o,a),m(o,d),m(o,p),m(o,g),m(o,h),m(o,_),m(o,E),A||(C=w(E,"click",x(e[0])),A=!0)},p:t,i:t,o:t,d(t){t&&v(n),A=!1,C()}}}function at(t,e,n){let{introDone:o=!1}=e;return t.$$set=t=>{"introDone"in t&&n(1,o=t.introDone)},[function(){n(1,o=!0)},o]}class ft extends it{constructor(t){super(),ct(this,t,at,ut,c,{introDone:1})}}function dt(t){let e,n,o,r,s,c,i,l,u,a,f,d=Math.floor(100*t[0])+"";return{c(){e=b("div"),n=b("div"),o=y(),r=b("div"),s=y(),c=b("div"),i=_("Loading "),l=_(d),u=_("%"),k(n,"class","loading-logo-grayscale svelte-1nu4cza"),k(r,"class","loading-logo svelte-1nu4cza"),A(r,"height",100*t[0]+"px"),k(e,"class","loader svelte-1nu4cza"),C(e,"loading",!t[3])},m(t,a){$(t,e,a),m(e,n),m(e,o),m(e,r),m(e,s),m(e,c),m(c,i),m(c,l),m(c,u),f=!0},p(t,n){(!f||1&n)&&A(r,"height",100*t[0]+"px"),(!f||1&n)&&d!==(d=Math.floor(100*t[0])+"")&&function(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}(l,d),8&n&&C(e,"loading",!t[3])},i(t){f||(q((()=>{a||(a=et(e,lt,{},!0)),a.run(1)})),f=!0)},o(t){a||(a=et(e,lt,{},!1)),a.run(0),f=!1},d(t){t&&v(e),t&&a&&a.end()}}}function pt(t){let e,n,o,s,c,i;return{c(){e=b("form"),n=b("input"),k(n,"class","query svelte-1nu4cza"),k(n,"placeholder","Tell me what to do and press enter !"),k(n,"autocomplete",""),n.autofocus=!0,k(e,"class","form svelte-1nu4cza")},m(o,r){$(o,e,r),m(e,n),E(n,t[2]),s=!0,n.focus(),c||(i=[w(n,"input",t[7]),w(e,"submit",x(t[4]))],c=!0)},p(t,e){4&e&&n.value!==t[2]&&E(n,t[2])},i(t){s||(q((()=>{o||(o=et(e,lt,{duration:300},!0)),o.run(1)})),s=!0)},o(t){o||(o=et(e,lt,{duration:300},!1)),o.run(0),s=!1},d(t){t&&v(e),t&&o&&o.end(),c=!1,r(i)}}}function mt(t){let e,n,o,r,s,c,i=!t[3]&&dt(t),u=t[3]&&pt(t);return{c(){e=b("div"),i&&i.c(),n=y(),o=b("iframe"),s=y(),u&&u.c(),k(o,"title","Forest Animal: Fox"),k(o,"frameborder","0"),o.allowFullscreen="true",k(o,"mozallowfullscreen","true"),k(o,"webkitallowfullscreen","true"),k(o,"allow","autoplay; fullscreen; xr-spatial-tracking"),k(o,"xr-spatial-tracking","true"),k(o,"execution-while-out-of-viewport","true"),k(o,"execution-while-not-rendered","true"),k(o,"web-share","true"),l(o.src,r="")||k(o,"src",""),k(o,"class","svelte-1nu4cza"),C(o,"viewer",t[1]),C(o,"started",t[3]),k(e,"class","container svelte-1nu4cza")},m(r,l){$(r,e,l),i&&i.m(e,null),m(e,n),m(e,o),t[6](o),m(e,s),u&&u.m(e,null),c=!0},p(t,[r]){t[3]?i&&(V(),Z(i,1,1,(()=>{i=null})),X()):i?(i.p(t,r),8&r&&Y(i,1)):(i=dt(t),i.c(),Y(i,1),i.m(e,n)),2&r&&C(o,"viewer",t[1]),8&r&&C(o,"started",t[3]),t[3]?u?(u.p(t,r),8&r&&Y(u,1)):(u=pt(t),u.c(),Y(u,1),u.m(e,null)):u&&(V(),Z(u,1,1,(()=>{u=null})),X())},i(t){c||(Y(i),Y(u),c=!0)},o(t){Z(i),Z(u),c=!1},d(n){n&&v(e),i&&i.d(),t[6](null),u&&u.d()}}}function gt(t,e,n){let o,r,s,{modelUid:c="abf5788c354f4d4b9ff5ea1fd10c6496"}=e,i=0,l=!1;l=!0;let u,a="";return O((()=>{s=new Sketchfab(r),s.init(c,{success:t=>{s=t,s.start(),s.addEventListener("modelLoadProgress",(function(t){n(0,i=t.progress)})),s.addEventListener("viewerready",(function(){s.getAnimations((function(t,e){u=e.filter((t=>{const e=t[1];return"Walk"!==e&&"Roll"!==e&&"Run"!==e&&"Land"!==e&&"Idle_2"!==e}))}))}))}})})),t.$$set=t=>{"modelUid"in t&&n(5,c=t.modelUid)},t.$$.update=()=>{1&t.$$.dirty&&n(3,o=i>=1)},[i,r,a,o,async function(){const t=await fetch("https://api-inference.huggingface.co/models/facebook/bart-large-mnli",{method:"POST",body:JSON.stringify({inputs:(e=a,e.trim().toLowerCase()),parameters:{candidate_labels:u.map((t=>t[1].replaceAll("_"," ")))}})});var e;let o=(await t.json()).labels[0];for(const t of u)if(t[1].replaceAll("_"," ").toLowerCase()===o.trim().toLowerCase()){const e=t[0];s.setCurrentAnimationByUID(e)}n(2,a="")},c,function(t){T[t?"unshift":"push"]((()=>{r=t,n(1,r)}))},function(){a=this.value,n(2,a)}]}class ht extends it{constructor(t){super(),ct(this,t,gt,mt,c,{modelUid:5})}}function $t(t){let e,n,o;function r(e){t[1](e)}let s={};return void 0!==t[0]&&(s.introDone=t[0]),e=new ft({props:s}),T.push((()=>function(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))}(e,"introDone",r))),{c(){nt(e.$$.fragment)},m(t,n){ot(e,t,n),o=!0},p(t,o){const r={};var s;!n&&1&o&&(n=!0,r.introDone=t[0],s=()=>n=!1,F.push(s)),e.$set(r)},i(t){o||(Y(e.$$.fragment,t),o=!0)},o(t){Z(e.$$.fragment,t),o=!1},d(t){rt(e,t)}}}function vt(e){let n,o;return n=new ht({}),{c(){nt(n.$$.fragment)},m(t,e){ot(n,t,e),o=!0},p:t,i(t){o||(Y(n.$$.fragment,t),o=!0)},o(t){Z(n.$$.fragment,t),o=!1},d(t){rt(n,t)}}}function bt(t){let e,n,o,r;const s=[vt,$t],c=[];function i(t,e){return t[0]?0:1}return e=i(t),n=c[e]=s[e](t),{c(){n.c(),o=_("")},m(t,n){c[e].m(t,n),$(t,o,n),r=!0},p(t,[r]){let l=e;e=i(t),e===l?c[e].p(t,r):(V(),Z(c[l],1,1,(()=>{c[l]=null})),X(),n=c[e],n?n.p(t,r):(n=c[e]=s[e](t),n.c()),Y(n,1),n.m(o.parentNode,o))},i(t){r||(Y(n),r=!0)},o(t){Z(n),r=!1},d(t){c[e].d(t),t&&v(o)}}}function _t(t,e,n){let o=!1;return[o,function(t){o=t,n(0,o)}]}return new class extends it{constructor(t){super(),ct(this,t,_t,bt,c,{})}}({target:document.body,props:{}})}();
2
  //# sourceMappingURL=bundle.js.map
build/bundle.js.map CHANGED
The diff for this file is too large to render. See raw diff
index.html CHANGED
@@ -6,11 +6,11 @@
6
 
7
  <title>HuggingFab: A HuggingFace + Sketchfab Experiment</title>
8
 
9
- <link rel='icon' type='image/png' href='/favicon.png'>
10
- <link rel='stylesheet' href='/global.css'>
11
- <link rel='stylesheet' href='/build/bundle.css'>
12
 
13
- <script defer src='/build/bundle.js'></script>
14
  <script type="text/javascript" src="https://static.sketchfab.com/api/sketchfab-viewer-1.10.1.js"></script>
15
  </head>
16
 
6
 
7
  <title>HuggingFab: A HuggingFace + Sketchfab Experiment</title>
8
 
9
+ <link rel='icon' type='image/png' href='./favicon.png'>
10
+ <link rel='stylesheet' href='./global.css'>
11
+ <link rel='stylesheet' href='./build/bundle.css'>
12
 
13
+ <script defer src='./build/bundle.js'></script>
14
  <script type="text/javascript" src="https://static.sketchfab.com/api/sketchfab-viewer-1.10.1.js"></script>
15
  </head>
16