diff --git a/frontend/dist/index.js b/frontend/dist/index.js index 67ede72a..2c853655 100755 --- a/frontend/dist/index.js +++ b/frontend/dist/index.js @@ -3913,7 +3913,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"fetchTextResource\": () => (/* binding */ fetchTextResource),\n/* harmony export */ \"postVoice\": () => (/* binding */ postVoice),\n/* harmony export */ \"uploadModelProps\": () => (/* binding */ uploadModelProps),\n/* harmony export */ \"uploadModelPropsResumable\": () => (/* binding */ uploadModelPropsResumable)\n/* harmony export */ });\n/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")[\"Buffer\"];\n// import Resumable from 'resumablejs'\n// import { file } from \"jszip\";\nconst fetchTextResource = async (url) => {\n const res = await fetch(url, {\n method: \"GET\"\n });\n const text = res.text();\n return text;\n};\nconst postVoice = async (url, gpu, srcId, dstId, timestamp, buffer) => {\n const obj = {\n gpu, srcId, dstId, timestamp, buffer: Buffer.from(buffer).toString('base64')\n };\n const body = JSON.stringify(obj);\n const res = await fetch(`${url}`, {\n method: \"POST\",\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: body\n });\n const receivedJson = await res.json();\n const changedVoiceBase64 = receivedJson[\"changedVoiceBase64\"];\n const buf = Buffer.from(changedVoiceBase64, \"base64\");\n const ab = new ArrayBuffer(buf.length);\n // console.log(\"RECIV\", buf.length)\n const view = new Uint8Array(ab);\n for (let i = 0; i < buf.length; ++i) {\n view[i] = buf[i];\n }\n return ab;\n};\nconst uploadModelProps = (modelFile, configFile, onprogress) => {\n const req = new XMLHttpRequest();\n const formData = new FormData();\n formData.append(\"modelFile\", modelFile);\n formData.append(\"configFile\", configFile);\n req.upload.onprogress = (ev) => {\n const progress = Math.ceil(ev.loaded / ev.total * 10000 / 100);\n console.log(\"Progress:\", ev.loaded, ev.total, progress);\n onprogress(progress, ev.loaded == ev.total);\n };\n req.upload.onloadend = (ev) => {\n console.log(\"Progress[END!]:\", ev.loaded, ev.total, Math.ceil(ev.loaded / ev.total * 10000 / 100));\n onprogress(100, true);\n };\n req.open(\"POST\", '/upload_model_file');\n req.send(formData);\n};\nconst uploadModelPropsResumable = async (modelFile, _configFile, _onprogress) => {\n const size = 1024 * 1024 * 5;\n const fileChunks = [];\n let index = 0; // index値\n for (let cur = 0; cur < modelFile.size; cur += size) {\n fileChunks.push({\n hash: index++,\n chunk: modelFile.slice(cur, cur + size),\n });\n }\n console.log(\"FILE_CHUNKS:\", fileChunks);\n for (const x of fileChunks) {\n console.log(\"SEND CHUNK:\", x.hash);\n const p = new Promise((resolve, _reject) => {\n // const req = new XMLHttpRequest();\n const formData = new FormData();\n formData.append(\"file\", x.chunk);\n formData.append(\"filename\", \"file_\" + x.hash);\n // req.upload.onprogress = (ev: ProgressEvent) => {\n // const progress = Math.ceil(ev.loaded / ev.total * 10000 / 100)\n // console.log(\"Progress:\", ev.loaded, ev.total, progress)\n // // onprogress(progress, ev.loaded == ev.total)\n // }\n // req.upload.onloadend = (ev: ProgressEvent) => {\n // console.log(\"Progress[END!]:\", ev.loaded, ev.total, Math.ceil(ev.loaded / ev.total * 10000 / 100))\n // resolve()\n // // onprogress(100, true)\n // }\n // req.open(\"POST\", '/resumable');\n // req.send(formData);\n const request = new Request('/resumable', {\n method: 'POST',\n body: formData,\n });\n fetch(request).then(async (response) => {\n console.log(await response.text());\n resolve();\n });\n });\n console.log(\"SEND CHUNK wait:\", x.hash);\n await p;\n console.log(\"SEND CHUNK done:\", x.hash);\n }\n // const res = new Resumable({\n // target: '/resumable',\n // // chunkSize: 100 * 1024,\n // simultaneousUploads: 1,\n // })\n // res.on(\"progress\", () => {\n // console.log(\"PROGRESS:\", res.progress)\n // })\n // res.on(\"uploadStart\", () => {\n // console.log(\"uploadStart:\")\n // })\n // res.on(\"fileSuccess\", (file: Resumable.ResumableFile) => {\n // console.log(\"fileSuccess:\", file)\n // })\n // res.on(\"fileAdded\", () => {\n // console.log(\"fileAdded:\")\n // })\n // res.on(\"fileError\", () => {\n // console.log(\"fileError:\")\n // })\n // res.addFile(modelFile)\n // res.addFile(_configFile)\n // console.log(\"send\", res.files, res.getSize())\n // res.upload()\n};\n\n\n//# sourceURL=webpack://voice-changer-internal/./frontend/src/001_clients_and_managers/002_ResourceLoader.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"fetchTextResource\": () => (/* binding */ fetchTextResource),\n/* harmony export */ \"postVoice\": () => (/* binding */ postVoice),\n/* harmony export */ \"uploadModelProps\": () => (/* binding */ uploadModelProps),\n/* harmony export */ \"uploadModelPropsResumable\": () => (/* binding */ uploadModelPropsResumable)\n/* harmony export */ });\n/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")[\"Buffer\"];\n// import Resumable from 'resumablejs'\n// import { file } from \"jszip\";\nconst fetchTextResource = async (url) => {\n const res = await fetch(url, {\n method: \"GET\"\n });\n const text = res.text();\n return text;\n};\nconst postVoice = async (url, gpu, srcId, dstId, timestamp, buffer) => {\n const obj = {\n gpu, srcId, dstId, timestamp, buffer: Buffer.from(buffer).toString('base64')\n };\n const body = JSON.stringify(obj);\n const res = await fetch(`${url}`, {\n method: \"POST\",\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: body\n });\n const receivedJson = await res.json();\n const changedVoiceBase64 = receivedJson[\"changedVoiceBase64\"];\n const buf = Buffer.from(changedVoiceBase64, \"base64\");\n const ab = new ArrayBuffer(buf.length);\n // console.log(\"RECIV\", buf.length)\n const view = new Uint8Array(ab);\n for (let i = 0; i < buf.length; ++i) {\n view[i] = buf[i];\n }\n return ab;\n};\nconst uploadModelProps = (modelFile, configFile, onprogress) => {\n const req = new XMLHttpRequest();\n const formData = new FormData();\n formData.append(\"modelFile\", modelFile);\n formData.append(\"configFile\", configFile);\n req.upload.onprogress = (ev) => {\n const progress = Math.ceil(ev.loaded / ev.total * 10000 / 100);\n console.log(\"Progress:\", ev.loaded, ev.total, progress);\n onprogress(progress, ev.loaded == ev.total);\n };\n req.upload.onloadend = (ev) => {\n console.log(\"Progress[END!]:\", ev.loaded, ev.total, Math.ceil(ev.loaded / ev.total * 10000 / 100));\n onprogress(100, true);\n };\n req.open(\"POST\", '/upload_model_file');\n req.send(formData);\n};\nconst uploadModelPropsResumable = async (modelFile, _configFile, _onprogress) => {\n const size = 1024 * 1024 * 25;\n const fileChunks = [];\n let index = 0; // index値\n for (let cur = 0; cur < modelFile.size; cur += size) {\n fileChunks.push({\n hash: index++,\n chunk: modelFile.slice(cur, cur + size),\n });\n }\n console.log(\"FILE_CHUNKS:\", fileChunks);\n for (const x of fileChunks) {\n console.log(\"SEND CHUNK:\", x.hash);\n const p = new Promise((resolve, _reject) => {\n // const req = new XMLHttpRequest();\n const formData = new FormData();\n formData.append(\"file\", x.chunk);\n formData.append(\"filename\", \"file_\" + x.hash);\n // req.upload.onprogress = (ev: ProgressEvent) => {\n // const progress = Math.ceil(ev.loaded / ev.total * 10000 / 100)\n // console.log(\"Progress:\", ev.loaded, ev.total, progress)\n // // onprogress(progress, ev.loaded == ev.total)\n // }\n // req.upload.onloadend = (ev: ProgressEvent) => {\n // console.log(\"Progress[END!]:\", ev.loaded, ev.total, Math.ceil(ev.loaded / ev.total * 10000 / 100))\n // resolve()\n // // onprogress(100, true)\n // }\n // req.open(\"POST\", '/resumable');\n // req.send(formData);\n const request = new Request('/resumable', {\n method: 'POST',\n body: formData,\n });\n fetch(request).then(async (response) => {\n console.log(await response.text());\n resolve();\n });\n });\n console.log(\"SEND CHUNK wait:\", x.hash);\n await p;\n console.log(\"SEND CHUNK done:\", x.hash);\n }\n // const res = new Resumable({\n // target: '/resumable',\n // // chunkSize: 100 * 1024,\n // simultaneousUploads: 1,\n // })\n // res.on(\"progress\", () => {\n // console.log(\"PROGRESS:\", res.progress)\n // })\n // res.on(\"uploadStart\", () => {\n // console.log(\"uploadStart:\")\n // })\n // res.on(\"fileSuccess\", (file: Resumable.ResumableFile) => {\n // console.log(\"fileSuccess:\", file)\n // })\n // res.on(\"fileAdded\", () => {\n // console.log(\"fileAdded:\")\n // })\n // res.on(\"fileError\", () => {\n // console.log(\"fileError:\")\n // })\n // res.addFile(modelFile)\n // res.addFile(_configFile)\n // console.log(\"send\", res.files, res.getSize())\n // res.upload()\n};\n\n\n//# sourceURL=webpack://voice-changer-internal/./frontend/src/001_clients_and_managers/002_ResourceLoader.ts?"); /***/ }), diff --git a/trainer/Dockerfile b/trainer/Dockerfile index 5097dda4..2ce50c31 100644 --- a/trainer/Dockerfile +++ b/trainer/Dockerfile @@ -1,4 +1,4 @@ -FROM dannadori/voice-changer-internal:20221030_202147 as front +FROM dannadori/voice-changer-internal:20221030_202944 as front FROM debian:bullseye-slim as base ARG DEBIAN_FRONTEND=noninteractive