Skip to content

Commit

Permalink
Fix display for sherpa-onnx-microphone (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Apr 16, 2024
1 parent fb4aee8 commit 81b7f1d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sherpa-onnx/csrc/sherpa-onnx-microphone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ for a list of pre-trained models to download.

std::string last_text;
int32_t segment_index = 0;
sherpa_onnx::Display display;
sherpa_onnx::Display display(30);
while (!stop) {
while (recognizer.IsReady(s.get())) {
recognizer.DecodeStream(s.get());
Expand All @@ -163,14 +163,13 @@ for a list of pre-trained models to download.
std::transform(text.begin(), text.end(), text.begin(),
[](auto c) { return std::tolower(c); });

fprintf(stderr, "\r%d: %s", segment_index, text.c_str());
display.Print(segment_index, text);
fflush(stderr);
}

if (is_endpoint) {
if (!text.empty()) {
++segment_index;
fprintf(stderr, "\n");
}

recognizer.Reset(s.get());
Expand Down

0 comments on commit 81b7f1d

Please sign in to comment.