Skip to content

Update language and model at runtime #115

Description

@gakoo35

Hi!

I love this asset and it works really well. The only issue I'm having is that I'm trying to change the language and the model at runtime with dropdown for the selection.

I managed to make it work for the language with the following script:

async public void OnUpdateLanguage(int index) { Destroy(whisper.gameObject); whisper = Instantiate(whisper); whisper.language = languageDropdown.options[index].text; await whisper.InitModel(); _stream = await whisper.CreateStream(microphoneRecord); _stream.OnResultUpdated += OnResult; _stream.OnSegmentUpdated += OnSegmentUpdated; _stream.OnSegmentFinished += OnSegmentFinished; _stream.OnStreamFinished += OnFinished; print($"Language updated to: {whisper.language}"); }

This is a bit messy since I'm having to create a new instance of the WhisperManager to force the init of the component with the new language.

This approach sadly doesn't seem to be working for the model selection.

Is there any way to integrate a system that let's you update the config of the model at runtime ? Or is there a specific reason why it's not possible ?

Thanks for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions