Skip to content

Commit

Permalink
updated java README
Browse files Browse the repository at this point in the history
  • Loading branch information
nalbion committed Jun 6, 2023
1 parent 5b9e59b commit 57543c1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bindings/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ This package provides Java JNI bindings for whisper.cpp. They have been tested o

The "low level" bindings are in `WhisperCppJnaLibrary`. The most simple usage is as follows:

JNA will attempt to load the `whispercpp` shared library from:

- jna.library.path
- jna.platform.library
- ~/Library/Frameworks
- /Library/Frameworks
- /System/Library/Frameworks
- classpath

```java
import io.github.ggerganov.whispercpp.WhisperCpp;

Expand All @@ -19,7 +28,12 @@ public class Example {
// or you can provide the absolute path to the model file.
long context = whisper.initContext("base.en");
try {
whisper.fullTranscribe(context, samples);
var whisperParams = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);
// custom configuration if required
whisperParams.temperature_inc = 0f;

var samples = readAudio(); // divide each value by 32767.0f
whisper.fullTranscribe(whisperParams, samples);

int segmentCount = whisper.getTextSegmentCount(context);
for (int i = 0; i < segmentCount; i++) {
Expand Down

0 comments on commit 57543c1

Please sign in to comment.