Spaces:
Running
Running
updated java README
Browse files- bindings/java/README.md +15 -1
bindings/java/README.md
CHANGED
|
@@ -8,6 +8,15 @@ This package provides Java JNI bindings for whisper.cpp. They have been tested o
|
|
| 8 |
|
| 9 |
The "low level" bindings are in `WhisperCppJnaLibrary`. The most simple usage is as follows:
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
```java
|
| 12 |
import io.github.ggerganov.whispercpp.WhisperCpp;
|
| 13 |
|
|
@@ -19,7 +28,12 @@ public class Example {
|
|
| 19 |
// or you can provide the absolute path to the model file.
|
| 20 |
long context = whisper.initContext("base.en");
|
| 21 |
try {
|
| 22 |
-
whisper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
int segmentCount = whisper.getTextSegmentCount(context);
|
| 25 |
for (int i = 0; i < segmentCount; i++) {
|
|
|
|
| 8 |
|
| 9 |
The "low level" bindings are in `WhisperCppJnaLibrary`. The most simple usage is as follows:
|
| 10 |
|
| 11 |
+
JNA will attempt to load the `whispercpp` shared library from:
|
| 12 |
+
|
| 13 |
+
- jna.library.path
|
| 14 |
+
- jna.platform.library
|
| 15 |
+
- ~/Library/Frameworks
|
| 16 |
+
- /Library/Frameworks
|
| 17 |
+
- /System/Library/Frameworks
|
| 18 |
+
- classpath
|
| 19 |
+
|
| 20 |
```java
|
| 21 |
import io.github.ggerganov.whispercpp.WhisperCpp;
|
| 22 |
|
|
|
|
| 28 |
// or you can provide the absolute path to the model file.
|
| 29 |
long context = whisper.initContext("base.en");
|
| 30 |
try {
|
| 31 |
+
var whisperParams = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);
|
| 32 |
+
// custom configuration if required
|
| 33 |
+
whisperParams.temperature_inc = 0f;
|
| 34 |
+
|
| 35 |
+
var samples = readAudio(); // divide each value by 32767.0f
|
| 36 |
+
whisper.fullTranscribe(whisperParams, samples);
|
| 37 |
|
| 38 |
int segmentCount = whisper.getTextSegmentCount(context);
|
| 39 |
for (int i = 0; i < segmentCount; i++) {
|