Spaces:
Running
Running
ecneladis
commited on
server : add --print-realtime param (#1541)
Browse files* server : add --print-realtime param
* Fix duplicate realtime output
- examples/server/README.md +1 -0
- examples/server/server.cpp +4 -1
examples/server/README.md
CHANGED
|
@@ -33,6 +33,7 @@ options:
|
|
| 33 |
-nf, --no-fallback [false ] do not use temperature fallback while decoding
|
| 34 |
-ps, --print-special [false ] print special tokens
|
| 35 |
-pc, --print-colors [false ] print colors
|
|
|
|
| 36 |
-pp, --print-progress [false ] print progress
|
| 37 |
-nt, --no-timestamps [false ] do not print timestamps
|
| 38 |
-l LANG, --language LANG [en ] spoken language ('auto' for auto-detect)
|
|
|
|
| 33 |
-nf, --no-fallback [false ] do not use temperature fallback while decoding
|
| 34 |
-ps, --print-special [false ] print special tokens
|
| 35 |
-pc, --print-colors [false ] print colors
|
| 36 |
+
-pr, --print-realtime [false ] print output in realtime
|
| 37 |
-pp, --print-progress [false ] print progress
|
| 38 |
-nt, --no-timestamps [false ] do not print timestamps
|
| 39 |
-l LANG, --language LANG [en ] spoken language ('auto' for auto-detect)
|
examples/server/server.cpp
CHANGED
|
@@ -72,6 +72,7 @@ struct whisper_params {
|
|
| 72 |
bool no_fallback = false;
|
| 73 |
bool print_special = false;
|
| 74 |
bool print_colors = false;
|
|
|
|
| 75 |
bool print_progress = false;
|
| 76 |
bool no_timestamps = false;
|
| 77 |
bool use_gpu = true;
|
|
@@ -144,6 +145,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
|
|
| 144 |
fprintf(stderr, " -nf, --no-fallback [%-7s] do not use temperature fallback while decoding\n", params.no_fallback ? "true" : "false");
|
| 145 |
fprintf(stderr, " -ps, --print-special [%-7s] print special tokens\n", params.print_special ? "true" : "false");
|
| 146 |
fprintf(stderr, " -pc, --print-colors [%-7s] print colors\n", params.print_colors ? "true" : "false");
|
|
|
|
| 147 |
fprintf(stderr, " -pp, --print-progress [%-7s] print progress\n", params.print_progress ? "true" : "false");
|
| 148 |
fprintf(stderr, " -nt, --no-timestamps [%-7s] do not print timestamps\n", params.no_timestamps ? "true" : "false");
|
| 149 |
fprintf(stderr, " -l LANG, --language LANG [%-7s] spoken language ('auto' for auto-detect)\n", params.language.c_str());
|
|
@@ -188,6 +190,7 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params, serve
|
|
| 188 |
else if (arg == "-fp" || arg == "--font-path") { params.font_path = argv[++i]; }
|
| 189 |
else if (arg == "-ps" || arg == "--print-special") { params.print_special = true; }
|
| 190 |
else if (arg == "-pc" || arg == "--print-colors") { params.print_colors = true; }
|
|
|
|
| 191 |
else if (arg == "-pp" || arg == "--print-progress") { params.print_progress = true; }
|
| 192 |
else if (arg == "-nt" || arg == "--no-timestamps") { params.no_timestamps = true; }
|
| 193 |
else if (arg == "-l" || arg == "--language") { params.language = argv[++i]; }
|
|
@@ -544,7 +547,7 @@ int main(int argc, char ** argv) {
|
|
| 544 |
whisper_print_user_data user_data = { ¶ms, &pcmf32s, 0 };
|
| 545 |
|
| 546 |
// this callback is called on each new segment
|
| 547 |
-
if (
|
| 548 |
wparams.new_segment_callback = whisper_print_segment_callback;
|
| 549 |
wparams.new_segment_callback_user_data = &user_data;
|
| 550 |
}
|
|
|
|
| 72 |
bool no_fallback = false;
|
| 73 |
bool print_special = false;
|
| 74 |
bool print_colors = false;
|
| 75 |
+
bool print_realtime = false;
|
| 76 |
bool print_progress = false;
|
| 77 |
bool no_timestamps = false;
|
| 78 |
bool use_gpu = true;
|
|
|
|
| 145 |
fprintf(stderr, " -nf, --no-fallback [%-7s] do not use temperature fallback while decoding\n", params.no_fallback ? "true" : "false");
|
| 146 |
fprintf(stderr, " -ps, --print-special [%-7s] print special tokens\n", params.print_special ? "true" : "false");
|
| 147 |
fprintf(stderr, " -pc, --print-colors [%-7s] print colors\n", params.print_colors ? "true" : "false");
|
| 148 |
+
fprintf(stderr, " -pr, --print-realtime [%-7s] print output in realtime\n", params.print_realtime ? "true" : "false");
|
| 149 |
fprintf(stderr, " -pp, --print-progress [%-7s] print progress\n", params.print_progress ? "true" : "false");
|
| 150 |
fprintf(stderr, " -nt, --no-timestamps [%-7s] do not print timestamps\n", params.no_timestamps ? "true" : "false");
|
| 151 |
fprintf(stderr, " -l LANG, --language LANG [%-7s] spoken language ('auto' for auto-detect)\n", params.language.c_str());
|
|
|
|
| 190 |
else if (arg == "-fp" || arg == "--font-path") { params.font_path = argv[++i]; }
|
| 191 |
else if (arg == "-ps" || arg == "--print-special") { params.print_special = true; }
|
| 192 |
else if (arg == "-pc" || arg == "--print-colors") { params.print_colors = true; }
|
| 193 |
+
else if (arg == "-pr" || arg == "--print-realtime") { params.print_realtime = true; }
|
| 194 |
else if (arg == "-pp" || arg == "--print-progress") { params.print_progress = true; }
|
| 195 |
else if (arg == "-nt" || arg == "--no-timestamps") { params.no_timestamps = true; }
|
| 196 |
else if (arg == "-l" || arg == "--language") { params.language = argv[++i]; }
|
|
|
|
| 547 |
whisper_print_user_data user_data = { ¶ms, &pcmf32s, 0 };
|
| 548 |
|
| 549 |
// this callback is called on each new segment
|
| 550 |
+
if (params.print_realtime) {
|
| 551 |
wparams.new_segment_callback = whisper_print_segment_callback;
|
| 552 |
wparams.new_segment_callback_user_data = &user_data;
|
| 553 |
}
|