| | |
| | | #include <iostream> |
| | | #include <memory> |
| | | #include <string> |
| | | #include <unordered_map> |
| | | #include <chrono> |
| | | #include <sstream> |
| | | |
| | | #include <grpc/grpc.h> |
| | | #include <grpcpp/server.h> |
| | |
| | | #include <grpcpp/server_context.h> |
| | | #include <grpcpp/security/server_credentials.h> |
| | | |
| | | #include "paraformer.grpc.pb.h" |
| | | #include <unordered_map> |
| | | #include <chrono> |
| | | |
| | | #include "paraformer.grpc.pb.h" |
| | | #include "librapidasrapi.h" |
| | | |
| | | |
| | | using grpc::Server; |
| | |
| | | using paraformer::Response; |
| | | using paraformer::ASR; |
| | | |
| | | typedef struct |
| | | { |
| | | std::string msg; |
| | | float snippet_time; |
| | | }RPASR_RECOG_RESULT; |
| | | |
| | | |
| | | class ASRServicer final : public ASR::Service { |
| | | private: |
| | |
| | | std::unordered_map<std::string, std::string> client_transcription; |
| | | |
| | | public: |
| | | ASRServicer(); |
| | | ASRServicer(const char* model_path, int thread_num, bool quantize); |
| | | void clear_states(const std::string& user); |
| | | void clear_buffers(const std::string& user); |
| | | void clear_transcriptions(const std::string& user); |
| | | void disconnect(const std::string& user); |
| | | grpc::Status Recognize(grpc::ServerContext* context, grpc::ServerReaderWriter<Response, Request>* stream); |
| | | RPASR_HANDLE AsrHanlde; |
| | | |
| | | }; |