From c80e698fc3b5250622aa2f56cd0761d881034ccd Mon Sep 17 00:00:00 2001 From: Alexander Suvorov Date: Tue, 29 Oct 2024 22:34:14 +0100 Subject: [PATCH] Revert sample --- .../whisper_speech_recognition.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/samples/cpp/whisper_speech_recognition/whisper_speech_recognition.cpp b/samples/cpp/whisper_speech_recognition/whisper_speech_recognition.cpp index 4773d163b4..c4f75858ae 100644 --- a/samples/cpp/whisper_speech_recognition/whisper_speech_recognition.cpp +++ b/samples/cpp/whisper_speech_recognition/whisper_speech_recognition.cpp @@ -16,22 +16,16 @@ int main(int argc, char* argv[]) try { ov::genai::WhisperPipeline pipeline(models_path, device); ov::genai::WhisperGenerationConfig config(models_path / "generation_config.json"); - // config.max_new_tokens = 100; // increase this based on your speech length + config.max_new_tokens = 100; // increase this based on your speech length // 'task' and 'language' parameters are supported for multilingual models only - // config.language = "<|en|>"; // can switch to <|zh|> for Chinese language - // config.task = "transcribe"; + config.language = "<|en|>"; // can switch to <|zh|> for Chinese language + config.task = "transcribe"; config.return_timestamps = true; - auto streamer = [](std::string word) { - std::cout << word; - return false; - }; - ov::genai::RawSpeechInput raw_speech = utils::audio::read_wav(wav_file_path); - auto result = pipeline.generate(raw_speech, config, streamer); - std::cout << '\n'; - std::cout << '\n'; - std::cout << result << '\n'; + auto result = pipeline.generate(raw_speech, config); + + std::cout << result << "\n"; for (auto& chunk : *result.chunks) { std::cout << "timestamps: [" << chunk.start_ts << ", " << chunk.end_ts << "] text: " << chunk.text << "\n";