whisper

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Sample Rate
	SampleRate = whisper.SampleRate
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFn added in v0.0.9

type LogFn func(string)

type Opt added in v0.0.9

type Opt func(*opts) error

func OptDebug added in v0.0.9

func OptDebug() Opt

Set debugging

func OptLog added in v0.0.9

func OptLog(fn LogFn) Opt

Set logging function

func OptMaxConcurrent added in v0.0.9

func OptMaxConcurrent(v int) Opt

Set maximum number of concurrent tasks

func OptNoGPU added in v0.0.9

func OptNoGPU() Opt

Disable GPU acceleration

type Whisper

type Whisper struct {
	// contains filtered or unexported fields
}

Whisper represents a whisper service for running transcription and translation

func New

func New(path string, opt ...Opt) (*Whisper, error)

Create a new whisper service with the path to the models directory and optional parameters

func (*Whisper) Close

func (w *Whisper) Close() error

Release all resources

func (*Whisper) DeleteModelById

func (w *Whisper) DeleteModelById(id string) error

Delete a model by its id

func (*Whisper) DownloadModel

func (w *Whisper) DownloadModel(ctx context.Context, path string, fn func(curBytes, totalBytes uint64)) (*schema.Model, error)

Download a model by path, where the directory is the root of the model within the models directory. The model is returned immediately if it already exists in the store

func (*Whisper) GetModelById

func (w *Whisper) GetModelById(id string) *schema.Model

Get a model by its Id, returns nil if the model does not exist

func (*Whisper) ListModels

func (w *Whisper) ListModels() []*schema.Model

Return all models in the models directory

func (*Whisper) MarshalJSON added in v0.0.9

func (w *Whisper) MarshalJSON() ([]byte, error)

func (*Whisper) String added in v0.0.9

func (w *Whisper) String() string

func (*Whisper) WithModel added in v0.0.9

func (w *Whisper) WithModel(model *schema.Model, fn func(task *task.Context) error) error

Get a task for the specified model, which may load the model or return an existing one. The context can then be used to run the Transcribe function, and after the context is returned to the pool.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL