Merge branch 'main' of github.com:alibaba-damo-academy/FunASR
add
| | |
| | | TCLAP::CmdLine cmd("funasr-onnx-2pass", ' ', "1.0"); |
| | | TCLAP::ValueArg<std::string> offline_model_dir("", OFFLINE_MODEL_DIR, "the asr offline model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); |
| | | TCLAP::ValueArg<std::string> online_model_dir("", ONLINE_MODEL_DIR, "the asr online model path, which contains encoder.onnx, decoder.onnx, config.yaml, am.mvn", true, "", "string"); |
| | | TCLAP::ValueArg<std::string> quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "false", "string"); |
| | | TCLAP::ValueArg<std::string> quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string"); |
| | | TCLAP::ValueArg<std::string> vad_dir("", VAD_DIR, "the vad online model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); |
| | | TCLAP::ValueArg<std::string> vad_quant("", VAD_QUANT, "false (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string"); |
| | | TCLAP::ValueArg<std::string> punc_dir("", PUNC_DIR, "the punc online model path, which contains model.onnx, punc.yaml", false, "", "string"); |
| | |
| | | char* speech_buff = audio.GetSpeechChar(); |
| | | int buff_len = audio.GetSpeechLen()*2; |
| | | |
| | | int step = 1600*2; |
| | | int step = 800*2; |
| | | bool is_final = false; |
| | | |
| | | string online_res=""; |
| | |
| | | namespace funasr { |
| | | typedef struct |
| | | { |
| | | std::string msg; |
| | | std::string tpass_msg; |
| | | float snippet_time; |
| | | std::string msg=""; |
| | | std::string tpass_msg=""; |
| | | float snippet_time=0; |
| | | }FUNASR_RECOG_RESULT; |
| | | |
| | | typedef struct |
| | | { |
| | | std::vector<std::vector<int>>* segments; |
| | | float snippet_time; |
| | | float snippet_time=0; |
| | | }FUNASR_VAD_RESULT; |
| | | |
| | | typedef struct |
| | | { |
| | | string msg; |
| | | string msg=0; |
| | | vector<string> arr_cache; |
| | | }FUNASR_PUNC_RESULT; |
| | | |
| | |
| | | vad_inputs.size(), vad_out_names_.data(), vad_out_names_.size()); |
| | | } catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when run vad onnx forword: " << (e.what()); |
| | | exit(0); |
| | | exit(-1); |
| | | } |
| | | |
| | | // 5. Change infer result to output shapes |
| | |
| | | |
| | | funasr::FUNASR_RECOG_RESULT* p_result = new funasr::FUNASR_RECOG_RESULT; |
| | | p_result->snippet_time = audio->GetTimeLen(); |
| | | if(p_result->snippet_time == 0){ |
| | | return p_result; |
| | | } |
| | | // if(p_result->snippet_time == 0){ |
| | | // return p_result; |
| | | // } |
| | | |
| | | audio->Split(vad_online_handle, chunk_len, input_finished, mode); |
| | | |
| | |
| | | */ |
| | | void WaitABit() { |
| | | #ifdef WIN32 |
| | | Sleep(1000); |
| | | Sleep(300); |
| | | #else |
| | | sleep(1); |
| | | usleep(300); |
| | | #endif |
| | | } |
| | | std::atomic<int> wav_index(0); |
| | |
| | | jsonresult["is_speaking"] = false; |
| | | m_client.send(m_hdl, jsonresult.dump(), websocketpp::frame::opcode::text, |
| | | ec); |
| | | // WaitABit(); |
| | | WaitABit(); |
| | | } |
| | | websocketpp::client<T> m_client; |
| | | |