mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
feat: dynamic loading of kokorojs
This commit is contained in:
parent
094a82b264
commit
dc9445c4ec
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue