Skip to content

Commit 4047aa7

Browse files
committed
feat: 添加grpc协议接口调用sdk
1 parent deb770d commit 4047aa7

File tree

7 files changed

+727
-2
lines changed

7 files changed

+727
-2
lines changed

asrt_sdk/network/asrt.proto

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* Copyright 2016-2099 Ailemon.net
2+
3+
This file is part of ASRT Speech Recognition Tool.
4+
5+
ASRT is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
ASRT is distributed in the hope that it will be useful,
10+
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with ASRT. If not, see <https://www.gnu.org/licenses/>.
17+
============================================================================ */
18+
19+
syntax = "proto3";
20+
package asrt;
21+
22+
//定义服务接口
23+
service AsrtGrpcService {
24+
rpc Speech (SpeechRequest) returns (SpeechResponse) {} //一个服务中可以定义多个接口,也就是多个函数功能
25+
rpc Language (LanguageRequest) returns (TextResponse) {}
26+
rpc All (SpeechRequest) returns (TextResponse) {}
27+
rpc Stream (stream SpeechRequest) returns (stream TextResponse) {}
28+
}
29+
30+
message SpeechRequest {
31+
WavData wav_data = 1;
32+
}
33+
34+
message SpeechResponse {
35+
int32 status_code = 1;
36+
string status_message = 2;
37+
repeated string result_data = 3; // 拼音结果
38+
}
39+
40+
message LanguageRequest {
41+
repeated string pinyins = 1;
42+
}
43+
44+
message TextResponse {
45+
int32 status_code = 1;
46+
string status_message = 2;
47+
string text_result = 3;
48+
}
49+
50+
message WavData{
51+
bytes samples = 1; // wav样本点字节
52+
int32 sample_rate = 2; // wav采样率
53+
int32 channels = 3; // wav通道数
54+
int32 byte_width = 4; // wav样本字节宽度
55+
}

asrt_sdk/network/asrt_pb2.py

Lines changed: 336 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)