Committed by
GitHub
Fix display for sherpa-onnx-microphone (#773)
正在显示
1 个修改的文件
包含
2 行增加
和
3 行删除
| @@ -148,7 +148,7 @@ for a list of pre-trained models to download. | @@ -148,7 +148,7 @@ for a list of pre-trained models to download. | ||
| 148 | 148 | ||
| 149 | std::string last_text; | 149 | std::string last_text; |
| 150 | int32_t segment_index = 0; | 150 | int32_t segment_index = 0; |
| 151 | - sherpa_onnx::Display display; | 151 | + sherpa_onnx::Display display(30); |
| 152 | while (!stop) { | 152 | while (!stop) { |
| 153 | while (recognizer.IsReady(s.get())) { | 153 | while (recognizer.IsReady(s.get())) { |
| 154 | recognizer.DecodeStream(s.get()); | 154 | recognizer.DecodeStream(s.get()); |
| @@ -163,14 +163,13 @@ for a list of pre-trained models to download. | @@ -163,14 +163,13 @@ for a list of pre-trained models to download. | ||
| 163 | std::transform(text.begin(), text.end(), text.begin(), | 163 | std::transform(text.begin(), text.end(), text.begin(), |
| 164 | [](auto c) { return std::tolower(c); }); | 164 | [](auto c) { return std::tolower(c); }); |
| 165 | 165 | ||
| 166 | - fprintf(stderr, "\r%d: %s", segment_index, text.c_str()); | 166 | + display.Print(segment_index, text); |
| 167 | fflush(stderr); | 167 | fflush(stderr); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | if (is_endpoint) { | 170 | if (is_endpoint) { |
| 171 | if (!text.empty()) { | 171 | if (!text.empty()) { |
| 172 | ++segment_index; | 172 | ++segment_index; |
| 173 | - fprintf(stderr, "\n"); | ||
| 174 | } | 173 | } |
| 175 | 174 | ||
| 176 | recognizer.Reset(s.get()); | 175 | recognizer.Reset(s.get()); |
-
请 注册 或 登录 后发表评论