Download sd-3dmodel-loader/javascript/3d-model-loader-import.js from toto10/extensions: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/toto10/extensions/resolve/refs%2Fpr%2F4/sd-3dmodel-loader/javascript/3d-model-loader-import.js
- Command line
-
hf download hf://toto10/extensions@refs/pr/4/sd-3dmodel-loader/javascript/3d-model-loader-import.js
-
curl -L -o 3d-model-loader-import.js https://huggingface.co/toto10/extensions/resolve/refs%2Fpr%2F4/sd-3dmodel-loader/javascript/3d-model-loader-import.js
1.38 kB
| (function () { | |
| if (!globalThis.threeDModelLoader) globalThis.threeDModelLoader = {}; | |
| const threeDModelLoader = globalThis.threeDModelLoader; | |
| function load(cont) { | |
| const scripts = cont.textContent.trim().split('\n'); | |
| const base_path = `/file=${scripts.shift()}/js`; | |
| cont.textContent = ''; | |
| const df = document.createDocumentFragment(); | |
| for (let src of scripts) { | |
| const script = document.createElement('script'); | |
| script.async = true; | |
| script.type = 'module'; | |
| script.src = `file=${src}`; | |
| df.appendChild(script); | |
| } | |
| globalThis.threeDModelLoader.import = async () => { | |
| const threeDModelLoader = await import(`${base_path}/3d-model-loader.bundle.js`); | |
| return {threeDModelLoader}; | |
| }; | |
| if (!globalThis.threeDModelLoader.imports) { | |
| globalThis.threeDModelLoader.imports = {}; | |
| } | |
| if (!globalThis.threeDModelLoader.imports.threeDModelLoader) { | |
| globalThis.threeDModelLoader.imports.threeDModelLoader = async () => await import(`${base_path}/3d-model-loader.bundle.js`); | |
| } | |
| cont.appendChild(df); | |
| } | |
| onUiLoaded(function () { | |
| webGLOutputDiv3DModel = gradioApp().querySelector('#WebGL-output-3dmodel-import'); | |
| load(webGLOutputDiv3DModel); | |
| }) | |
| })(); |