feat: dynamic loading of kokorojs
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import { createEventDispatcher, onMount, getContext } from 'svelte';
|
import { createEventDispatcher, onMount, getContext } from 'svelte';
|
||||||
import { KokoroTTS } from 'kokoro-js';
|
|
||||||
|
|
||||||
import { user, settings, config } from '$lib/stores';
|
import { user, settings, config } from '$lib/stores';
|
||||||
import { getVoices as _getVoices } from '$lib/apis/audio';
|
import { getVoices as _getVoices } from '$lib/apis/audio';
|
||||||
@@ -128,6 +127,7 @@
|
|||||||
|
|
||||||
const model_id = 'onnx-community/Kokoro-82M-v1.0-ONNX';
|
const model_id = 'onnx-community/Kokoro-82M-v1.0-ONNX';
|
||||||
|
|
||||||
|
const { KokoroTTS } = await import('kokoro-js');
|
||||||
TTSModel = await KokoroTTS.from_pretrained(model_id, {
|
TTSModel = await KokoroTTS.from_pretrained(model_id, {
|
||||||
dtype: TTSEngineConfig.dtype, // Options: "fp32", "fp16", "q8", "q4", "q4f16"
|
dtype: TTSEngineConfig.dtype, // Options: "fp32", "fp16", "q8", "q4", "q4f16"
|
||||||
device: !!navigator?.gpu ? 'webgpu' : 'wasm', // Detect WebGPU
|
device: !!navigator?.gpu ? 'webgpu' : 'wasm', // Detect WebGPU
|
||||||
|
|||||||
Reference in New Issue
Block a user