Skip to content

Commit

Permalink
whisper.objc : fix context + broken readme links
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Nov 27, 2022
1 parent e266cb0 commit 164df0d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/command.wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It runs in fully in the browser via WebAseembly.

Online demo: https://whisper.ggerganov.com/command/

Terminal version: https://github.com/ggerganov/whisper.cpp/examples/command
Terminal version: [examples/command](/examples/command)

## Build instructions

Expand Down
2 changes: 1 addition & 1 deletion examples/command/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ More info is available in [issue #171](https://github.com/ggerganov/whisper.cpp/

https://user-images.githubusercontent.com/1991296/204038393-2f846eae-c255-4099-a76d-5735c25c49da.mp4

Web version: https://github.com/ggerganov/whisper.cpp/examples/command.wasm
Web version: [examples/command.wasm](/examples/command.wasm)

## Building

Expand Down
4 changes: 4 additions & 0 deletions examples/whisper.objc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The inference runs locally, on-device.

https://user-images.githubusercontent.com/1991296/197385372-962a6dea-bca1-4d50-bf96-1d8c27b98c81.mp4

Real-time transcription demo:

https://user-images.githubusercontent.com/1991296/204126266-ce4177c6-6eca-4bd9-bca8-0e46d9da2364.mp4

## Usage

```java
Expand Down
6 changes: 5 additions & 1 deletion examples/whisper.objc/whisper.objc/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ - (IBAction)onTranscribe:(id)sender {
params.language = "en";
params.n_threads = max_threads;
params.offset_ms = 0;
params.no_context = true;
params.single_segment = self->stateInp.isRealtime;

CFTimeInterval startTime = CACurrentMediaTime();
Expand Down Expand Up @@ -228,8 +229,11 @@ - (IBAction)onTranscribe:(id)sender {
result = [result stringByAppendingString:[NSString stringWithUTF8String:text_cur]];
}

const float tRecording = (float)self->stateInp.n_samples / (float)self->stateInp.dataFormat.mSampleRate;

// append processing time
result = [result stringByAppendingString:[NSString stringWithFormat:@"\n\n[processing time: %5.3f s]", endTime - startTime]];
result = [result stringByAppendingString:[NSString stringWithFormat:@"\n\n[recording time: %5.3f s]", tRecording]];
result = [result stringByAppendingString:[NSString stringWithFormat:@" \n[processing time: %5.3f s]", endTime - startTime]];

// dispatch the result to the main thread
dispatch_async(dispatch_get_main_queue(), ^{
Expand Down

0 comments on commit 164df0d

Please sign in to comment.