From 34d0f12741eaa8fac842d32416efcc38dc306cf6 Mon Sep 17 00:00:00 2001 From: Manickavela Date: Fri, 28 Feb 2025 17:24:13 +0000 Subject: [PATCH 1/4] refactor and pybind --- .../online-websocket-server.py | 40 +++++ sherpa-onnx/csrc/CMakeLists.txt | 3 + sherpa-onnx/csrc/online-websocket-server.cc | 154 +++++++++++------ sherpa-onnx/csrc/online-websocket-server.h | 33 ++++ sherpa-onnx/python/csrc/CMakeLists.txt | 1 + .../csrc/online-websocket-server-app.cc | 40 +++++ .../python/csrc/online-websocket-server-app.h | 16 ++ sherpa-onnx/python/csrc/sherpa-onnx.cc | 2 + sherpa-onnx/python/sherpa_onnx/__init__.py | 1 + .../sherpa_onnx/online_websocket_server.py | 161 ++++++++++++++++++ 10 files changed, 395 insertions(+), 56 deletions(-) create mode 100644 python-api-examples/online-websocket-server.py create mode 100644 sherpa-onnx/csrc/online-websocket-server.h create mode 100644 sherpa-onnx/python/csrc/online-websocket-server-app.cc create mode 100644 sherpa-onnx/python/csrc/online-websocket-server-app.h create mode 100644 sherpa-onnx/python/sherpa_onnx/online_websocket_server.py diff --git a/python-api-examples/online-websocket-server.py b/python-api-examples/online-websocket-server.py new file mode 100644 index 0000000000..9fe705bd2b --- /dev/null +++ b/python-api-examples/online-websocket-server.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# Copyright 2025 Uniphore + +''' +Real-time speech recognition server using WebSockets. +Python API interface to start the server. +Python wrapper around implementation of online-websocket-server.cc in C++. + +(1) Download streaming transducer model + +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-en-2023-06-26.tar.bz2 +tar xvf sherpa-onnx-streaming-zipformer-en-2023-06-26.tar.bz2 +rm sherpa-onnx-streaming-zipformer-en-2023-06-26.tar.bz2 + +(2) Starting websocket server using the downloaded model + +python3 ./python-api-examples/online-websocket-server.py \ + --tokens=./sherpa-onnx-streaming-zipformer-en-2023-06-26/tokens.txt \ + --encoder=./sherpa-onnx-streaming-zipformer-en-2023-06-26/encoder-epoch-99-avg-1-chunk-16-left-128.onnx \ + --decoder=./sherpa-onnx-streaming-zipformer-en-2023-06-26/decoder-epoch-99-avg-1-chunk-16-left-128.onnx \ + --joiner=./sherpa-onnx-streaming-zipformer-en-2023-06-26/joiner-epoch-99-avg-1-chunk-16-left-128.onnx \ + --max-batch-size=5 \ + --loop-interval-ms=10 + +''' +import argparse +import sys +import signal +from sherpa_onnx import OnlineWebSocketServer + +def signal_handler(sig, frame): + print('Exiting...') + sys.exit(0) + +# Bind SIGINT to signal_handler +signal.signal(signal.SIGINT, signal_handler) + +if __name__ == "__main__": + args = sys.argv[:] + OnlineWebSocketServer(server_args=args) \ No newline at end of file diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index aa50c4ab8f..e8246d45c1 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -87,6 +87,9 @@ set(sources online-transducer-model.cc online-transducer-modified-beam-search-decoder.cc online-transducer-nemo-model.cc + online-transducer-greedy-search-nemo-decoder.cc + online-websocket-server.cc + online-websocket-server-impl.cc online-wenet-ctc-model-config.cc online-wenet-ctc-model.cc online-zipformer-transducer-model.cc diff --git a/sherpa-onnx/csrc/online-websocket-server.cc b/sherpa-onnx/csrc/online-websocket-server.cc index 6ba7a19861..35c23851c2 100644 --- a/sherpa-onnx/csrc/online-websocket-server.cc +++ b/sherpa-onnx/csrc/online-websocket-server.cc @@ -1,11 +1,12 @@ // sherpa-onnx/csrc/online-websocket-server.cc // // Copyright (c) 2022-2023 Xiaomi Corporation +// Copyright (c) 2025 Uniphore (Author: Manickavela A) -#include "asio.hpp" -#include "sherpa-onnx/csrc/macros.h" -#include "sherpa-onnx/csrc/online-websocket-server-impl.h" -#include "sherpa-onnx/csrc/parse-options.h" +#include +#include + +#include "sherpa-onnx/csrc/online-websocket-server.h" static constexpr const char *kUsageMessage = R"( Automatic speech recognition with sherpa-onnx using websocket. @@ -30,80 +31,121 @@ Please refer to for a list of pre-trained models to download. )"; -int32_t main(int32_t argc, char *argv[]) { - sherpa_onnx::ParseOptions po(kUsageMessage); +// Global server instance pointer for signal handling +OnlineWebsocketServerApp *global_server_instance = nullptr; + +// Signal handler to stop the server +void SignalHandler(int signal) { + if (signal == SIGINT || signal == SIGTERM) { + SHERPA_ONNX_LOGE("\nSignal %d received. Stopping server...", signal); + if (global_server_instance) { + global_server_instance->Stop(); + } + } +} + +OnlineWebsocketServerApp::OnlineWebsocketServerApp( + int32_t argc, char *argv[]) : argc_(argc), argv_(argv) {} + +void OnlineWebsocketServerApp::Run() { + sherpa_onnx::ParseOptions po(kUsageMessage); sherpa_onnx::OnlineWebsocketServerConfig config; - // the server will listen on this port - int32_t port = 6006; + // the server will listen on this port + int32_t port = 6006; - // size of the thread pool for handling network connections - int32_t num_io_threads = 1; + // size of the thread pool for handling network connections + int32_t num_io_threads = 1; - // size of the thread pool for neural network computation and decoding - int32_t num_work_threads = 3; + // size of the thread pool for neural network computation and decoding + int32_t num_work_threads = 3; - po.Register("num-io-threads", &num_io_threads, - "Thread pool size for network connections."); + po.Register("num-io-threads", &num_io_threads, + "Thread pool size for network connections."); - po.Register("num-work-threads", &num_work_threads, - "Thread pool size for for neural network " - "computation and decoding."); + po.Register("num-work-threads", &num_work_threads, + "Thread pool size for for neural network " + "computation and decoding."); - po.Register("port", &port, "The port on which the server will listen."); + po.Register("port", &port, "The port on which the server will listen."); - config.Register(&po); + config.Register(&po); - if (argc == 1) { - po.PrintUsage(); - exit(EXIT_FAILURE); - } + if (argc_ == 1) { + po.PrintUsage(); + exit(EXIT_FAILURE); + } - po.Read(argc, argv); + po.Read(argc_, argv_); - if (po.NumArgs() != 0) { - SHERPA_ONNX_LOGE("Unrecognized positional arguments!"); - po.PrintUsage(); - exit(EXIT_FAILURE); - } + if (po.NumArgs() != 0) { + SHERPA_ONNX_LOGE("Unrecognized positional arguments!"); + po.PrintUsage(); + exit(EXIT_FAILURE); + } - config.Validate(); + config.Validate(); - asio::io_context io_conn; // for network connections - asio::io_context io_work; // for neural network and decoding + // Set the global instance for signal handling + global_server_instance = this; - sherpa_onnx::OnlineWebsocketServer server(io_conn, io_work, config); - server.Run(port); + // Handle SIGINT and SIGTERM + std::signal(SIGINT, SignalHandler); + std::signal(SIGTERM, SignalHandler); - SHERPA_ONNX_LOGE("Started!"); - SHERPA_ONNX_LOGE("Listening on: %d", port); - SHERPA_ONNX_LOGE("Number of work threads: %d", num_work_threads); + // io_conn for network connections + // io_work for neural network and decoding - // give some work to do for the io_work pool - auto work_guard = asio::make_work_guard(io_work); + sherpa_onnx::OnlineWebsocketServer server(io_conn_, io_work_, config); + server.Run(port); - std::vector io_threads; + SHERPA_ONNX_LOGE("Started!"); + SHERPA_ONNX_LOGE("Listening on: %d", port); + SHERPA_ONNX_LOGE("Number of work threads: %d", num_work_threads); - // decrement since the main thread is also used for network communications - for (int32_t i = 0; i < num_io_threads - 1; ++i) { - io_threads.emplace_back([&io_conn]() { io_conn.run(); }); - } + // give some work to do for the io_work pool + auto work_guard = asio::make_work_guard(io_work_); - std::vector work_threads; - for (int32_t i = 0; i < num_work_threads; ++i) { - work_threads.emplace_back([&io_work]() { io_work.run(); }); - } + std::vector io_threads; - io_conn.run(); + // decrement since the main thread is also used for network communications + for (int32_t i = 0; i < num_io_threads - 1; ++i) { + io_threads.emplace_back([this]() { io_conn_.run(); }); + } - for (auto &t : io_threads) { - t.join(); - } + std::vector work_threads; + for (int32_t i = 0; i < num_work_threads; ++i) { + work_threads.emplace_back([this]() { io_work_.run(); }); + } - for (auto &t : work_threads) { - t.join(); - } + // Main thread handles IO + io_conn_.run(); - return 0; + for (auto &t : io_threads) { + t.join(); + } + + for (auto &t : work_threads) { + t.join(); + } + SHERPA_ONNX_LOGE("Server shut down gracefully."); +} + +void OnlineWebsocketServerApp::Stop() { + shutdown_requested_.store(true); + io_conn_.stop(); + io_work_.stop(); + SHERPA_ONNX_LOGE("Server stopping..."); } + +int32_t main(int32_t argc, char *argv[]) { + OnlineWebsocketServerApp app(argc, argv); + app.Run(); + return 0; +} + +void StartServer(int32_t argc, char *argv[]) { + OnlineWebsocketServerApp app(argc, argv); + app.Run(); +} \ No newline at end of file diff --git a/sherpa-onnx/csrc/online-websocket-server.h b/sherpa-onnx/csrc/online-websocket-server.h new file mode 100644 index 0000000000..f2f9a787cd --- /dev/null +++ b/sherpa-onnx/csrc/online-websocket-server.h @@ -0,0 +1,33 @@ +// sherpa-onnx/csrc/online-wenet-ctc-model-config.h +// +// Copyright (c) 2025 Uniphore (Author: Manickavela A)s + +#ifndef SHERPA_ONNX_ONLINE_WEBSOCKET_SERVER_H +#define SHERPA_ONNX_ONLINE_WEBSOCKET_SERVER_H + +#include +#include +#include "sherpa-onnx/csrc/macros.h" +#include "sherpa-onnx/csrc/online-websocket-server-impl.h" +#include "sherpa-onnx/csrc/parse-options.h" + +class OnlineWebsocketServerApp { +public: + OnlineWebsocketServerApp(int32_t argc, char *argv[]); + void Run(); + void Stop(); + +private: + int32_t argc_; + char **argv_; + asio::io_context io_conn_; // ASIO context for connections + asio::io_context io_work_; // ASIO context for work + std::atomic shutdown_requested_{false}; + std::vector io_threads_; + std::vector work_threads_; +}; + +// Declare StartServer so it's accessible for Pybind +void StartServer(int32_t argc, char *argv[]); + +#endif // SHERPA_ONNX_ONLINE_WEBSOCKET_SERVER_H diff --git a/sherpa-onnx/python/csrc/CMakeLists.txt b/sherpa-onnx/python/csrc/CMakeLists.txt index 95b96bf980..d3574ddad0 100644 --- a/sherpa-onnx/python/csrc/CMakeLists.txt +++ b/sherpa-onnx/python/csrc/CMakeLists.txt @@ -35,6 +35,7 @@ set(srcs online-transducer-model-config.cc online-wenet-ctc-model-config.cc online-zipformer2-ctc-model-config.cc + online-websocket-server-app.cc provider-config.cc sherpa-onnx.cc silero-vad-model-config.cc diff --git a/sherpa-onnx/python/csrc/online-websocket-server-app.cc b/sherpa-onnx/python/csrc/online-websocket-server-app.cc new file mode 100644 index 0000000000..bc19af879c --- /dev/null +++ b/sherpa-onnx/python/csrc/online-websocket-server-app.cc @@ -0,0 +1,40 @@ +// sherpa-onnx/python/csrc/online-websocket-server.cc +// +// Copyright (c) 2025 Uniphore (Author: Manickavela A) + +#include "sherpa-onnx/python/csrc/online-websocket-server-app.h" + +#include + +#include "asio.hpp" +#include "sherpa-onnx/csrc/online-websocket-server.h" +#include "sherpa-onnx/csrc/macros.h" + +namespace sherpa_onnx { + +void StartServerWrapper(py::list args) { + int argc = args.size(); + std::vector args_str; // Store actual strings + std::vector argv; // Store pointers to those strings + + for (const auto &arg : args) { + args_str.push_back(arg.cast()); + } + + // Fill argv with pointers to the actual string data + for (auto &str : args_str) { + argv.push_back(str.data()); + } + + argv.push_back(nullptr); // Null-terminate like C-style arrays + + // Call your server + StartServer(argc, argv.data()); +} + +void PybindOnlineWebsocketServerWrapperApp(py::module *m) { + m->def("start_server", &StartServerWrapper, "Start the WebSocket server", + py::call_guard()); +} + +} // namespace sherpa_onnx \ No newline at end of file diff --git a/sherpa-onnx/python/csrc/online-websocket-server-app.h b/sherpa-onnx/python/csrc/online-websocket-server-app.h new file mode 100644 index 0000000000..8d51a07a65 --- /dev/null +++ b/sherpa-onnx/python/csrc/online-websocket-server-app.h @@ -0,0 +1,16 @@ +// sherpa-onnx/python/csrc/online-websocket-server.h +// +// Copyright (c) 2025 Uniphore (Author: Manickavela A) + +#ifndef SHERPA_ONNX_PYTHON_CSRC_ONLINE_WEBSOCKET_SERVER_APP_H_ +#define SHERPA_ONNX_PYTHON_CSRC_ONLINE_WEBSOCKET_SERVER_APP_H_ + +#include "sherpa-onnx/python/csrc/sherpa-onnx.h" + + +namespace sherpa_onnx { + +void PybindOnlineWebsocketServerWrapperApp(py::module *m); + +} +#endif // SHERPA_ONNX_PYTHON_CSRC_ONLINE_WEBSOCKET_SERVER_H_ \ No newline at end of file diff --git a/sherpa-onnx/python/csrc/sherpa-onnx.cc b/sherpa-onnx/python/csrc/sherpa-onnx.cc index c73022f178..9058d1de69 100644 --- a/sherpa-onnx/python/csrc/sherpa-onnx.cc +++ b/sherpa-onnx/python/csrc/sherpa-onnx.cc @@ -23,6 +23,7 @@ #include "sherpa-onnx/python/csrc/online-punctuation.h" #include "sherpa-onnx/python/csrc/online-recognizer.h" #include "sherpa-onnx/python/csrc/online-stream.h" +#include "sherpa-onnx/python/csrc/online-websocket-server-app.h" #include "sherpa-onnx/python/csrc/speaker-embedding-extractor.h" #include "sherpa-onnx/python/csrc/speaker-embedding-manager.h" #include "sherpa-onnx/python/csrc/spoken-language-identification.h" @@ -56,6 +57,7 @@ PYBIND11_MODULE(_sherpa_onnx, m) { PybindOnlineModelConfig(&m); PybindOnlineLMConfig(&m); PybindOnlineStream(&m); + PybindOnlineWebsocketServerWrapperApp(&m); PybindEndpoint(&m); PybindOnlineRecognizer(&m); PybindKeywordSpotter(&m); diff --git a/sherpa-onnx/python/sherpa_onnx/__init__.py b/sherpa-onnx/python/sherpa_onnx/__init__.py index 5eeeffa566..7ec85eda89 100644 --- a/sherpa-onnx/python/sherpa_onnx/__init__.py +++ b/sherpa-onnx/python/sherpa_onnx/__init__.py @@ -46,4 +46,5 @@ from .keyword_spotter import KeywordSpotter from .offline_recognizer import OfflineRecognizer from .online_recognizer import OnlineRecognizer +from .online_websocket_server import OnlineWebSocketServer from .utils import text2token diff --git a/sherpa-onnx/python/sherpa_onnx/online_websocket_server.py b/sherpa-onnx/python/sherpa_onnx/online_websocket_server.py new file mode 100644 index 0000000000..ba12879c5e --- /dev/null +++ b/sherpa-onnx/python/sherpa_onnx/online_websocket_server.py @@ -0,0 +1,161 @@ +from typing import List +from _sherpa_onnx import start_server + +def dict_to_string(d : dict) -> str : + return " ".join([f"--{k.replace('_', '-')}={v}" for k, v in d.items()]) + +class OnlineWebSocketServer(object): + def __init__(self, + port: int = 8080, + tokens: str = "/path/to/tokens.txt", + encoder: str = "/path/to/encoder.onnx", + decoder: str = "/path/to/decoder.onnx", + joiner: str = "/path/to/joiner.onnx", + provider: str = 'cpu', + log_file: str = "./log.txt", + model_type: str = '', + modeling_unit: str = 'bpe', + bpe_vocab: str = '', + max_batch_size: int = 5, + loop_interval_ms: int = 10, + device: int = 0, + num_threads: int = 1, + num_io_threads: int = 2, + num_work_threads: int = 3, + decoding_method: str = 'greedy_search', + hotwords_score: float = 1.5, + hotwords_file: str = '', + blank_penalty: float = 0, + temperature_scale: float = 2, + end_tail_padding: float = 0.8, + max_active_paths: int = 4, + rule_fsts: str = '', + low_freq: int = 20, + feat_dim: int = 80, + dither: int = 0, + high_freq: int = -400, + sample_rate: int = 8000, + enable_endpoint: bool = True, + rule1_min_trailing_blanks: int = 2, + rule1_min_utterance_length: int = 0, + rule1_must_contain_nonsilence: bool = False, + rule1_min_trailing_silence: float = 2.4, + rule2_min_trailing_blanks: int = 2, + rule2_min_utterance_length: int = 0, + rule2_must_contain_nonsilence: bool = True, + rule2_min_trailing_silence: float = 1.2, + rule3_min_trailing_blanks: int = 2, + rule3_min_trailing_silence: int = 0, + rule3_must_contain_nonsilence: bool = False, + rule3_min_utterance_length: int = 20, + lm_num_threads: int = 1, + lm_provider: str = 'cpu', + lm: str = '', + lm_scale: float = 0.5, + rule_fars: str = '', + nemo_ctc_model: str = '', + zipformer2_ctc_model: str = '', + wenet_ctc_num_left_chunks: int = 4, + wenet_ctc_model: str = '', + wenet_ctc_chunk_size: int = 16, + paraformer_encoder: str = '', + paraformer_decoder: str = '', + ctc_graph: str = '', + ctc_max_active: int = 3000, + config: str = '', + help: bool = False, + print_args: bool = True, + warm_up: int = 0, + cuda_cudnn_conv_algo_search: int = 1, + trt_fp16_enable: bool = True, + trt_max_partition_iterations: int = 10, + trt_min_subgraph_size: int = 5, + trt_max_workspace_size: int = 2147483647, + trt_timing_cache_enable: bool = True, + trt_timing_cache_path: str = '.', + trt_engine_cache_enable: bool = True, + trt_engine_cache_path: str = '.', + trt_dump_subgraphs: bool = False, + trt_detailed_build_log: bool = False, + debug: bool = False, + ) : + + server_args = { + "port": port, + "tokens": tokens, + "encoder": encoder, + "decoder": decoder, + "joiner": joiner, + "provider": provider, + "log-file": log_file, + "model-type": model_type, + "modeling-unit": modeling_unit, + "bpe-vocab": bpe_vocab, + "max-batch-size": max_batch_size, + "loop-interval-ms": loop_interval_ms, + "device": device, + "num-threads": num_threads, + "num-io-threads": num_io_threads, + "num-work-threads": num_work_threads, + "decoding-method": decoding_method, + "hotwords-score": hotwords_score, + "hotwords-file": hotwords_file, + "blank-penalty": blank_penalty, + "temperature-scale": temperature_scale, + "end-tail-padding": end_tail_padding, + "max-active-paths": max_active_paths, + "rule-fsts": rule_fsts, + "low-freq": low_freq, + "feat-dim": feat_dim, + "dither": dither, + "high-freq": high_freq, + "sample-rate": sample_rate, + "enable-endpoint": enable_endpoint, + "rule1-min-trailing-blanks": rule1_min_trailing_blanks, + "rule1-min-utterance-length": rule1_min_utterance_length, + "rule1-must-contain-nonsilence": rule1_must_contain_nonsilence, + "rule1-min-trailing-silence": rule1_min_trailing_silence, + "rule2-min-trailing-blanks": rule2_min_trailing_blanks, + "rule2-min-utterance-length": rule2_min_utterance_length, + "rule2-must-contain-nonsilence": rule2_must_contain_nonsilence, + "rule2-min-trailing-silence": rule2_min_trailing_silence, + "rule3-min-trailing-blanks": rule3_min_trailing_blanks, + "rule3-min-trailing-silence": rule3_min_trailing_silence, + "rule3-must-contain-nonsilence": rule3_must_contain_nonsilence, + "rule3-min-utterance-length": rule3_min_utterance_length, + "lm-num-threads": lm_num_threads, + "lm-provider": lm_provider, + "lm": lm, + "lm-scale": lm_scale, + "rule-fars": rule_fars, + "nemo-ctc-model": nemo_ctc_model, + "zipformer2-ctc-model": zipformer2_ctc_model, + "wenet-ctc-num-left-chunks": wenet_ctc_num_left_chunks, + "wenet-ctc-model": wenet_ctc_model, + "wenet-ctc-chunk-size": wenet_ctc_chunk_size, + "paraformer-encoder": paraformer_encoder, + "paraformer-decoder": paraformer_decoder, + "ctc-graph": ctc_graph, + "ctc-max-active": ctc_max_active, + "config": config, + "help": help, + "print-args": print_args, + "warm-up": warm_up, + "cuda-cudnn-conv-algo-search": cuda_cudnn_conv_algo_search, + "trt-fp16-enable": trt_fp16_enable, + "trt-max-partition-iterations": trt_max_partition_iterations, + "trt-min-subgraph-size": trt_min_subgraph_size, + "trt-max-workspace-size": trt_max_workspace_size, + "trt-timing-cache-enable": trt_timing_cache_enable, + "trt-timing-cache-path": trt_timing_cache_path, + "trt-engine-cache-enable": trt_engine_cache_enable, + "trt-engine-cache-path": trt_engine_cache_path, + "trt-dump-subgraphs": trt_dump_subgraphs, + "trt-detailed-build-log": trt_detailed_build_log, + "debug": debug + } + self.server_args = server_args + start_server(dict_to_string(self.server_args)) + + def __init__(self, server_args : List[str]) : + start_server(server_args) \ No newline at end of file From b35d34955065a3b7f3ce66d6161995890cb6ea2c Mon Sep 17 00:00:00 2001 From: manickavlea29 Date: Fri, 28 Feb 2025 18:04:59 +0000 Subject: [PATCH 2/4] fix asio --- sherpa-onnx/csrc/online-websocket-server.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sherpa-onnx/csrc/online-websocket-server.h b/sherpa-onnx/csrc/online-websocket-server.h index f2f9a787cd..d008af50b3 100644 --- a/sherpa-onnx/csrc/online-websocket-server.h +++ b/sherpa-onnx/csrc/online-websocket-server.h @@ -5,8 +5,7 @@ #ifndef SHERPA_ONNX_ONLINE_WEBSOCKET_SERVER_H #define SHERPA_ONNX_ONLINE_WEBSOCKET_SERVER_H -#include -#include +#include "asio.hpp" #include "sherpa-onnx/csrc/macros.h" #include "sherpa-onnx/csrc/online-websocket-server-impl.h" #include "sherpa-onnx/csrc/parse-options.h" From ca1fda72be33e6cd171c1b19ff3801629f731556 Mon Sep 17 00:00:00 2001 From: manickavlea29 Date: Tue, 4 Mar 2025 02:57:22 +0000 Subject: [PATCH 3/4] remove asio python csrc --- sherpa-onnx/python/csrc/online-websocket-server-app.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sherpa-onnx/python/csrc/online-websocket-server-app.cc b/sherpa-onnx/python/csrc/online-websocket-server-app.cc index bc19af879c..8f3a215f3d 100644 --- a/sherpa-onnx/python/csrc/online-websocket-server-app.cc +++ b/sherpa-onnx/python/csrc/online-websocket-server-app.cc @@ -6,7 +6,6 @@ #include -#include "asio.hpp" #include "sherpa-onnx/csrc/online-websocket-server.h" #include "sherpa-onnx/csrc/macros.h" From 109c6ce5ee72fc52a3795bbbdd59cea3f17aed22 Mon Sep 17 00:00:00 2001 From: manickavlea29 Date: Tue, 4 Mar 2025 08:28:03 +0000 Subject: [PATCH 4/4] so file change --- sherpa-onnx/csrc/CMakeLists.txt | 1 - sherpa-onnx/python/csrc/CMakeLists.txt | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sherpa-onnx/csrc/CMakeLists.txt b/sherpa-onnx/csrc/CMakeLists.txt index e8246d45c1..cef3054003 100644 --- a/sherpa-onnx/csrc/CMakeLists.txt +++ b/sherpa-onnx/csrc/CMakeLists.txt @@ -88,7 +88,6 @@ set(sources online-transducer-modified-beam-search-decoder.cc online-transducer-nemo-model.cc online-transducer-greedy-search-nemo-decoder.cc - online-websocket-server.cc online-websocket-server-impl.cc online-wenet-ctc-model-config.cc online-wenet-ctc-model.cc diff --git a/sherpa-onnx/python/csrc/CMakeLists.txt b/sherpa-onnx/python/csrc/CMakeLists.txt index d3574ddad0..5b1da91037 100644 --- a/sherpa-onnx/python/csrc/CMakeLists.txt +++ b/sherpa-onnx/python/csrc/CMakeLists.txt @@ -35,7 +35,6 @@ set(srcs online-transducer-model-config.cc online-wenet-ctc-model-config.cc online-zipformer2-ctc-model-config.cc - online-websocket-server-app.cc provider-config.cc sherpa-onnx.cc silero-vad-model-config.cc @@ -48,6 +47,12 @@ set(srcs voice-activity-detector.cc wave-writer.cc ) + +list(APPEND srcs + ${CMAKE_SOURCE_DIR}/sherpa-onnx/csrc/online-websocket-server.cc + online-websocket-server-app.cc +) + if(SHERPA_ONNX_HAS_ALSA) list(APPEND srcs ${CMAKE_SOURCE_DIR}/sherpa-onnx/csrc/alsa.cc alsa.cc) else()