Skip to content

Commit

Permalink
Updated makefile rules
Browse files Browse the repository at this point in the history
  • Loading branch information
djthorpe committed Dec 18, 2022
1 parent 7007828 commit 5c6e4b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions bindings/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ test: model-small whisper

examples: $(EXAMPLES_DIR)

model-small: examples/go-model-download
model-small: mkdir examples/go-model-download
@${BUILD_DIR}/go-model-download -out models small.en

$(EXAMPLES_DIR): clean mkdir
$(EXAMPLES_DIR): mkdir whisper
@echo Build example $(notdir $@)
@go build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@

Expand Down
20 changes: 11 additions & 9 deletions bindings/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ is as follows:

```go
import (
"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
)

func main() {
var modelpath string // Path to the model
var samples []float32 // Samples to process
var modelpath string // Path to the model
var samples []float32 // Samples to process

// Load the model
// Load the model
model, err := whisper.New(modelpath)
if err != nil {
panic(err)
panic(err)
}
defer model.Close()

// Process samples
// Process samples
context, err := model.NewContext()
if err != nil {
panic(err)
panic(err)
}
if err := context.Process(samples); err != nil {
return err
Expand All @@ -38,8 +38,8 @@ func main() {
for {
segment, err := context.NextSegment()
if err != nil {
break
}
break
}
fmt.Printf("[%6s->%6s] %s\n", segment.Start, segment.End, segment.Text)
}
}
Expand All @@ -50,6 +50,8 @@ func main() {
In order to build, you need to have the Go compiler installed. You can get it from [here](https://golang.org/dl/). Run the tests with:

```bash
git clone https://github.com/ggerganov/whisper.cpp.git
cd whisper.cpp/bindings/go
make test
```

Expand Down

0 comments on commit 5c6e4b8

Please sign in to comment.