fix:sample

This commit is contained in:
wataru 2023-05-25 11:40:37 +09:00
parent 3037c3d2f9
commit d98168ebbe
16 changed files with 2928 additions and 1769 deletions

View File

@ -67,6 +67,10 @@
"name": "sampleModelSelect", "name": "sampleModelSelect",
"options": {} "options": {}
}, },
{
"name": "sampleDownloadControlRow",
"options": {}
},
{ {
"name": "defaultTuneRow2", "name": "defaultTuneRow2",
"options": {} "options": {}

View File

@ -1,10 +1 @@
<!DOCTYPE html> <!doctype html><html style="width:100%;height:100%;overflow:hidden"><head><meta charset="utf-8"/><title>Voice Changer Client Demo</title><script defer="defer" src="index.js"></script></head><body style="width:100%;height:100%;margin:0"><div id="app" style="width:100%;height:100%"></div></body></html>
<html style="width: 100%; height: 100%; overflow: hidden">
<head>
<meta charset="utf-8" />
<title>Voice Changer Client Demo</title>
<script defer src="index.js"></script></head>
<body style="width: 100%; height: 100%; margin: 0px">
<div id="app" style="width: 100%; height: 100%"></div>
</body>
</html>

File diff suppressed because one or more lines are too long

2783
client/demo/dist/index.js.LICENSE.txt vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,10 @@
"name": "sampleModelSelect", "name": "sampleModelSelect",
"options": {} "options": {}
}, },
{
"name": "sampleDownloadControlRow",
"options": {}
},
{ {
"name": "defaultTuneRow2", "name": "defaultTuneRow2",
"options": {} "options": {}

View File

@ -55,6 +55,7 @@ import { DiffSettingRow, DiffSettingRowProps } from "./components/612_DiffSettin
import { DiffMethodRow, DiffMethodRowProps } from "./components/613_DiffMethodRow" import { DiffMethodRow, DiffMethodRowProps } from "./components/613_DiffMethodRow"
import { ServerOpertationRow, ServerOpertationRowProps } from "./components/207_ServerOpertationRow" import { ServerOpertationRow, ServerOpertationRowProps } from "./components/207_ServerOpertationRow"
import { SampleModelSelectRow, SampleModelSelectRowProps } from "./components/301-j_SampleModelSelectRow" import { SampleModelSelectRow, SampleModelSelectRowProps } from "./components/301-j_SampleModelSelectRow"
import { SampleDownloadControlRow, SampleDownloadControlRowProps } from "./components/301-k_SampleDownloadControl"
export const catalog: { [key: string]: (props: any) => JSX.Element } = {} export const catalog: { [key: string]: (props: any) => JSX.Element } = {}
@ -94,6 +95,7 @@ const initialize = () => {
addToCatalog("modelSlotRow2", (props: ModelSlotRow2Props) => { return <ModelSlotRow2 {...props} /> }) addToCatalog("modelSlotRow2", (props: ModelSlotRow2Props) => { return <ModelSlotRow2 {...props} /> })
addToCatalog("defaultTuneRow2", (props: DefaultTuneRow2Props) => { return <DefaultTuneRow2 {...props} /> }) addToCatalog("defaultTuneRow2", (props: DefaultTuneRow2Props) => { return <DefaultTuneRow2 {...props} /> })
addToCatalog("sampleModelSelect", (props: SampleModelSelectRowProps) => { return <SampleModelSelectRow {...props} /> }) addToCatalog("sampleModelSelect", (props: SampleModelSelectRowProps) => { return <SampleModelSelectRow {...props} /> })
addToCatalog("sampleDownloadControlRow", (props: SampleDownloadControlRowProps) => { return <SampleDownloadControlRow {...props} /> })

View File

@ -0,0 +1,36 @@
import React, { useMemo, useState } from "react"
import { useAppState } from "../../../001_provider/001_AppStateProvider"
import { useGuiState } from "../001_GuiStateProvider"
export type SampleDownloadControlRowProps = {}
export const SampleDownloadControlRow = (_props: SampleDownloadControlRowProps) => {
const appState = useAppState()
const guiState = useGuiState()
const sampleDownloadControlRow = useMemo(() => {
const slot = guiState.modelSlotNum
const fileUploadSetting = appState.serverSetting.fileUploadSettings[slot]
if (!fileUploadSetting) {
return <></>
}
if (fileUploadSetting.isSampleMode == false) {
return <></>
}
return (
<div className="body-row split-3-3-4 left-padding-1 guided">
<div className="body-item-title left-padding-1 ">Advanced Configuration</div>
<div>
<input type="checkbox" checked={fileUploadSetting.rvcIndexDownload} onChange={(e) => {
appState.serverSetting.setFileUploadSetting(slot, { ...fileUploadSetting, rvcIndexDownload: e.target.checked })
}} /> useIndex
</div>
<div className="body-button-container">
</div>
</div>
)
}, [appState.serverSetting.fileUploadSettings, appState.serverSetting.setFileUploadSetting])
return sampleDownloadControlRow
}

View File

@ -1,12 +1,12 @@
{ {
"name": "@dannadori/voice-changer-client-js", "name": "@dannadori/voice-changer-client-js",
"version": "1.0.132", "version": "1.0.133",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@dannadori/voice-changer-client-js", "name": "@dannadori/voice-changer-client-js",
"version": "1.0.132", "version": "1.0.133",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@types/readable-stream": "^2.3.15", "@types/readable-stream": "^2.3.15",

View File

@ -1,6 +1,6 @@
{ {
"name": "@dannadori/voice-changer-client-js", "name": "@dannadori/voice-changer-client-js",
"version": "1.0.132", "version": "1.0.133",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"directories": { "directories": {

View File

@ -34,6 +34,7 @@ export type FileUploadSetting = {
isSampleMode: boolean isSampleMode: boolean
sampleId: string | null sampleId: string | null
rvcIndexDownload: boolean
ddspSvcModel: ModelData | null ddspSvcModel: ModelData | null
ddspSvcModelConfig: ModelData | null ddspSvcModelConfig: ModelData | null
@ -66,6 +67,8 @@ const InitialFileUploadSetting: FileUploadSetting = {
isSampleMode: false, isSampleMode: false,
sampleId: null, sampleId: null,
rvcIndexDownload: true,
ddspSvcModel: null, ddspSvcModel: null,
ddspSvcModelConfig: null, ddspSvcModelConfig: null,
@ -370,6 +373,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
defaultTune: fileUploadSetting.defaultTune || 0, defaultTune: fileUploadSetting.defaultTune || 0,
defaultIndexRatio: fileUploadSetting.defaultIndexRatio || 1, defaultIndexRatio: fileUploadSetting.defaultIndexRatio || 1,
sampleId: fileUploadSetting.isSampleMode ? fileUploadSetting.sampleId || "" : "", sampleId: fileUploadSetting.isSampleMode ? fileUploadSetting.sampleId || "" : "",
rvcIndexDownload: fileUploadSetting.rvcIndexDownload || false,
files: fileUploadSetting.isSampleMode ? {} : { files: fileUploadSetting.isSampleMode ? {} : {
mmvcv13Config: fileUploadSetting.mmvcv13Config?.filename || "", mmvcv13Config: fileUploadSetting.mmvcv13Config?.filename || "",
mmvcv13Model: fileUploadSetting.mmvcv13Model?.filename || "", mmvcv13Model: fileUploadSetting.mmvcv13Model?.filename || "",
@ -452,6 +456,7 @@ export const useServerSetting = (props: UseServerSettingProps): ServerSettingSta
isSampleMode: fileUploadSetting.isSampleMode, isSampleMode: fileUploadSetting.isSampleMode,
sampleId: fileUploadSetting.sampleId, sampleId: fileUploadSetting.sampleId,
rvcIndexDownload: fileUploadSetting.rvcIndexDownload,
} }
setItem(`${INDEXEDDB_KEY_MODEL_DATA}_${slot}`, saveData) setItem(`${INDEXEDDB_KEY_MODEL_DATA}_${slot}`, saveData)
} catch (e) { } catch (e) {

View File

@ -1,4 +1,4 @@
from dataclasses import dataclass from dataclasses import dataclass, field
import json import json
from const import ModelType from const import ModelType
@ -8,7 +8,7 @@ from const import ModelType
class RVCModelSample: class RVCModelSample:
id: str = "" id: str = ""
lang: str = "" lang: str = ""
tag: str = "" tag: list[str] = field(default_factory=lambda: [])
name: str = "" name: str = ""
modelUrl: str = "" modelUrl: str = ""
indexUrl: str = "" indexUrl: str = ""

View File

@ -101,6 +101,8 @@ class ServerAudioDeviceTypes(Enum):
SAMPLES_JSONS = [ SAMPLES_JSONS = [
# "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0001.json",
# "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0002.json",
"https://huggingface.co/wok000/vcclient_model/raw/main/samples_0003_t.json", "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0003_t.json",
"https://huggingface.co/wok000/vcclient_model/raw/main/samples_0003_o.json", "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0003_o.json",
] ]

View File

@ -3,7 +3,7 @@
{ {
"id": "KikotoKurage", "id": "KikotoKurage",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "黄琴海月", "name": "黄琴海月",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_kurage_48k_256/kikoto_kurage.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_kurage_48k_256/kikoto_kurage.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_kurage_48k_256/added_IVF2997_Flat_nprobe_11.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_kurage_48k_256/added_IVF2997_Flat_nprobe_11.index.bin",
@ -18,7 +18,7 @@
{ {
"id": "KikotoMahiro", "id": "KikotoMahiro",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "黄琴まひろ", "name": "黄琴まひろ",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_48k_256/kikoto_mahiro.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_48k_256/kikoto_mahiro.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_48k_256/added_IVF4833_Flat_nprobe_12.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/kikoto_mahiro_48k_256/added_IVF4833_Flat_nprobe_12.index.bin",
@ -33,7 +33,7 @@
{ {
"id": "TokinaShigure", "id": "TokinaShigure",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "刻鳴時雨", "name": "刻鳴時雨",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tokina_sigure/Shigure.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tokina_sigure/Shigure.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tokina_sigure/added_IVF1572_Flat_nprobe_9.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tokina_sigure/added_IVF1572_Flat_nprobe_9.index.bin",
@ -48,7 +48,7 @@
{ {
"id": "Amitaro", "id": "Amitaro",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "あみたろ", "name": "あみたろ",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_contentvec_256/amitaro48k-100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_contentvec_256/amitaro48k-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_contentvec_256/amitaro48k.0.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_contentvec_256/amitaro48k.0.index.bin",
@ -63,7 +63,7 @@
{ {
"id": "Amitaro_768d", "id": "Amitaro_768d",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "あみたろ(768d)", "name": "あみたろ(768d)",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_default/amitaro_hubertjp_768_def-100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_default/amitaro_hubertjp_768_def-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_default/amitaro_hubertjp_768_def.0.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_default/amitaro_hubertjp_768_def.0.index.bin",
@ -78,7 +78,7 @@
{ {
"id": "Amitaro_768n", "id": "Amitaro_768n",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "あみたろ(768n)", "name": "あみたろ(768n)",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_nadare/amitaro_hubert_jp-100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_nadare/amitaro_hubert_jp-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_nadare/amitaro_hubert_jp.0.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_nadare/amitaro_hubert_jp.0.index.bin",
@ -93,7 +93,7 @@
{ {
"id": "Amitaro_768t", "id": "Amitaro_768t",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "あみたろ(768t)", "name": "あみたろ(768t)",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor-100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor.0.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/amitaro_hubertjp_768_tylor/amitaro_hubertjp_768_tylor.0.index.bin",
@ -108,7 +108,7 @@
{ {
"id": "Tsukuyomi-chan_768d", "id": "Tsukuyomi-chan_768d",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "つくよみちゃん(768d)", "name": "つくよみちゃん(768d)",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def-100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def.0.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi-chan_hubertjp_768_default/tsukuyomi_hubertjp_768_def.0.index.bin",
@ -123,7 +123,7 @@
{ {
"id": "Tsukuyomi-chan", "id": "Tsukuyomi-chan",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "つくよみちゃん", "name": "つくよみちゃん",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi_contentvec_256/tsukuyomi48k-100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi_contentvec_256/tsukuyomi48k-100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi_contentvec_256/tsukuyomi48k.0.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc/tsukuyomi_contentvec_256/tsukuyomi48k.0.index.bin",

View File

@ -3,7 +3,7 @@
{ {
"id": "KikotoKurage_v2", "id": "KikotoKurage_v2",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "黄琴海月_v2", "name": "黄琴海月_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_kurage/kikoto_kurage_v2_40k_e100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_kurage/kikoto_kurage_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_kurage/added_IVF5181_Flat_nprobe_1_v2.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_kurage/added_IVF5181_Flat_nprobe_1_v2.index.bin",
@ -18,7 +18,7 @@
{ {
"id": "KikotoMahiro_v2", "id": "KikotoMahiro_v2",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "黄琴まひろ_v2", "name": "黄琴まひろ_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_mahiro/kikoto_mahiro_v2_40k.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_mahiro/kikoto_mahiro_v2_40k.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_mahiro/added_IVF6881_Flat_nprobe_1_v2.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/kikoto_mahiro/added_IVF6881_Flat_nprobe_1_v2.index.bin",
@ -33,7 +33,7 @@
{ {
"id": "TokinaShigure_v2", "id": "TokinaShigure_v2",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "刻鳴時雨_v2", "name": "刻鳴時雨_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tokina_shigure/tokina_shigure_v2_40k_e100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tokina_shigure/tokina_shigure_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tokina_shigure/added_IVF2736_Flat_nprobe_1_v2.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tokina_shigure/added_IVF2736_Flat_nprobe_1_v2.index.bin",
@ -48,7 +48,7 @@
{ {
"id": "Amitaro_v2", "id": "Amitaro_v2",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "あみたろ_v2", "name": "あみたろ_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/amitaro/amitaro_v2_40k_e100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/amitaro/amitaro_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/amitaro/added_IVF3139_Flat_nprobe_1_v2.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/amitaro/added_IVF3139_Flat_nprobe_1_v2.index.bin",
@ -63,7 +63,7 @@
{ {
"id": "Tsukuyomi-chan_v2", "id": "Tsukuyomi-chan_v2",
"lang": "ja-JP", "lang": "ja-JP",
"tag": "", "tag": ["torch", "test"],
"name": "つくよみちゃん_v2", "name": "つくよみちゃん_v2",
"modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tsukuyomi-chan/tsukuyomi_v2_40k_e100.pth", "modelUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tsukuyomi-chan/tsukuyomi_v2_40k_e100.pth",
"indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tsukuyomi-chan/added_IVF7852_Flat_nprobe_1_v2.index.bin", "indexUrl": "https://huggingface.co/wok000/vcclient_model/resolve/main/rvc_v2_alpha/tsukuyomi-chan/added_IVF7852_Flat_nprobe_1_v2.index.bin",

View File

@ -111,11 +111,14 @@ class RVC:
print("loadModel", params) print("loadModel", params)
# サンプルが指定されたときはダウンロードしてメタデータをでっちあげる # サンプルが指定されたときはダウンロードしてメタデータをでっちあげる
if len(params["sampleId"]) > 0: if len(params["sampleId"]) > 0:
sampleInfo = self.getSampleInfo(params["sampleId"]) sampleId = params["sampleId"]
sampleInfo = self.getSampleInfo(sampleId)
useIndex = params["rvcIndexDownload"]
if sampleInfo is None: if sampleInfo is None:
print("[Voice Changer] sampleInfo is None") print("[Voice Changer] sampleInfo is None")
return return
modelPath, indexPath = downloadModelFiles(sampleInfo) modelPath, indexPath = downloadModelFiles(sampleInfo, useIndex)
params["files"]["rvcModel"] = modelPath params["files"]["rvcModel"] = modelPath
if indexPath is not None: if indexPath is not None:
params["files"]["rvcIndex"] = indexPath params["files"]["rvcIndex"] = indexPath

View File

@ -16,10 +16,10 @@ def checkRvcModelExist(model_dir: str):
def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str): def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
sampleModelIds = [ sampleModelIds = [
"KikotoMahiro_o", ("TokinaShigure_o", True),
"TokinaShigure_o", ("KikotoMahiro_o", False),
"Amitaro_o", ("Amitaro_o", False),
"Tsukuyomi-chan_o", ("Tsukuyomi-chan_o", False),
] ]
sampleModels = getModelSamples(sampleJsons, "RVC") sampleModels = getModelSamples(sampleJsons, "RVC")
if sampleModels is None: if sampleModels is None:
@ -28,8 +28,19 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
downloadParams = [] downloadParams = []
slot_count = 0 slot_count = 0
line_num = 0 line_num = 0
for initSampleId in sampleModelIds:
print(initSampleId)
# 初期サンプルをサーチ
match = False
for sample in sampleModels: for sample in sampleModels:
if sample.id in sampleModelIds: if sample.id == initSampleId[0]:
match = True
break
if match is False:
print(f"[Voice Changer] initiail sample not found. {initSampleId[0]}")
continue
# 検出されたら、、、
sampleParams: Any = {"files": {}} sampleParams: Any = {"files": {}}
slotDir = os.path.join(model_dir, RVC_MODEL_DIRNAME, str(slot_count)) slotDir = os.path.join(model_dir, RVC_MODEL_DIRNAME, str(slot_count))
@ -48,7 +59,11 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
sampleParams["files"]["rvcModel"] = modelFilePath sampleParams["files"]["rvcModel"] = modelFilePath
line_num += 1 line_num += 1
if hasattr(sample, "indexUrl") and sample.indexUrl != "": if (
initSampleId[1] is True
and hasattr(sample, "indexUrl")
and sample.indexUrl != ""
):
indexPath = os.path.join( indexPath = os.path.join(
slotDir, slotDir,
os.path.basename(sample.indexUrl), os.path.basename(sample.indexUrl),
@ -84,7 +99,7 @@ def downloadInitialSampleModels(sampleJsons: list[str], model_dir: str):
pool.map(download, downloadParams) pool.map(download, downloadParams)
def downloadModelFiles(sampleInfo: RVCModelSample): def downloadModelFiles(sampleInfo: RVCModelSample, useIndex: bool = True):
downloadParams = [] downloadParams = []
modelPath = os.path.join(TMP_DIR, os.path.basename(sampleInfo.modelUrl)) modelPath = os.path.join(TMP_DIR, os.path.basename(sampleInfo.modelUrl))
@ -97,7 +112,12 @@ def downloadModelFiles(sampleInfo: RVCModelSample):
) )
indexPath = None indexPath = None
if hasattr(sampleInfo, "indexUrl") and sampleInfo.indexUrl != "": if (
useIndex is True
and hasattr(sampleInfo, "indexUrl")
and sampleInfo.indexUrl != ""
):
print("[Voice Changer] Download sample with index.")
indexPath = os.path.join(TMP_DIR, os.path.basename(sampleInfo.indexUrl)) indexPath = os.path.join(TMP_DIR, os.path.basename(sampleInfo.indexUrl))
downloadParams.append( downloadParams.append(
{ {