funasr功能提交
This commit is contained in:
parent
d7c837ba32
commit
fce3ab57ac
|
@ -66,13 +66,13 @@ parser.add_argument("--ncpu",
|
|||
help="cpu cores")
|
||||
parser.add_argument("--certfile",
|
||||
type=str,
|
||||
default="../../ssl_key/server.crt",
|
||||
default="ssl_key/server.crt",
|
||||
required=False,
|
||||
help="certfile for ssl")
|
||||
|
||||
parser.add_argument("--keyfile",
|
||||
type=str,
|
||||
default="../../ssl_key/server.key",
|
||||
default="ssl_key/server.key",
|
||||
required=False,
|
||||
help="keyfile for ssl")
|
||||
args = parser.parse_args()
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
1、启动语言识别服务端
|
||||
python funasr_wss_server.py --host "0.0.0.0" --port 10197 --ngpu 0
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
## certificate generation by yourself
|
||||
generated certificate may not suitable for all browsers due to security concerns. you'd better buy or download an authenticated ssl certificate from authorized agency.
|
||||
|
||||
```shell
|
||||
### 1) Generate a private key
|
||||
openssl genrsa -des3 -out server.key 2048
|
||||
|
||||
### 2) Generate a csr file
|
||||
openssl req -new -key server.key -out server.csr
|
||||
|
||||
### 3) Remove pass
|
||||
cp server.key server.key.org
|
||||
openssl rsa -in server.key.org -out server.key
|
||||
|
||||
### 4) Generated a crt file, valid for 1 year
|
||||
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
|
||||
```
|
|
@ -0,0 +1,17 @@
|
|||
## 自行生成证书
|
||||
生成证书(注意这种证书并不能被所有浏览器认可,部分手动授权可以访问,最好使用其他认证的官方ssl证书)
|
||||
|
||||
```shell
|
||||
### 1)生成私钥,按照提示填写内容
|
||||
openssl genrsa -des3 -out server.key 1024
|
||||
|
||||
### 2)生成csr文件 ,按照提示填写内容
|
||||
openssl req -new -key server.key -out server.csr
|
||||
|
||||
### 去掉pass
|
||||
cp server.key server.key.org
|
||||
openssl rsa -in server.key.org -out server.key
|
||||
|
||||
### 生成crt文件,有效期1年(365天)
|
||||
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
|
||||
```
|
|
@ -0,0 +1,21 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDhTCCAm0CFGB0Po2IZ0hESavFpcSGRNb9xrNXMA0GCSqGSIb3DQEBCwUAMH8x
|
||||
CzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdiZWlqaW5nMRAwDgYDVQQHDAdiZWlqaW5n
|
||||
MRAwDgYDVQQKDAdhbGliYWJhMRAwDgYDVQQLDAdhbGliYWJhMRAwDgYDVQQDDAdh
|
||||
bGliYWJhMRYwFAYJKoZIhvcNAQkBFgdhbGliYWJhMB4XDTIzMDYxODA2NTcxM1oX
|
||||
DTI0MDYxNzA2NTcxM1owfzELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB2JlaWppbmcx
|
||||
EDAOBgNVBAcMB2JlaWppbmcxEDAOBgNVBAoMB2FsaWJhYmExEDAOBgNVBAsMB2Fs
|
||||
aWJhYmExEDAOBgNVBAMMB2FsaWJhYmExFjAUBgkqhkiG9w0BCQEWB2FsaWJhYmEw
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDH9Np1oBunQKMt5M/nU2nD
|
||||
qVHojXwKKwyiK9DSeGikKwArH2S9NUZNu5RDg46u0iWmT+Vz+toQhkJnfatOVskW
|
||||
f2bsI54n5eOvmoWOKDXYm2MscvjkuNiYRbqzgUuP9ZSx8k3uyRs++wvmwIoU+PV1
|
||||
EYFcjk1P2jUGUvKaUlmIDsjs1wOMIbKO6I0UX20FNKlGWacqMR/Dx2ltmGKT1Kaz
|
||||
Y335lor0bcfQtH542rGS7PDz6JMRNjFT1VFcmnrjRElf4STbaOiIfOjMVZ/9O8Hr
|
||||
LFItyvkb01Mt7O0jhAXHuE1l/8Y0N3MCYkELG9mQA0BYCFHY0FLuJrGoU03b8KWj
|
||||
AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAEjC9jB1WZe2ki2JgCS+eAMFsFegiNEz
|
||||
D0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GxN8opCzVjgWa
|
||||
-----END RSA PRIVATE KEY-----
|
|
@ -0,0 +1,128 @@
|
|||
<!-- index.html -->
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="mpegts-1.7.3.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.sockjs.org/sockjs-0.3.4.js"></script>
|
||||
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script src="recorder-core.js" charset="UTF-8"></script>
|
||||
<script src="wav.js" charset="UTF-8"></script>
|
||||
<script src="pcm.js" charset="UTF-8"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>metahuman voice test</h1>
|
||||
<form class="form-inline" id="echo-form">
|
||||
<div class="form-group">
|
||||
<p>input text</p>
|
||||
|
||||
<textarea cols="2" rows="3" style="width:600px;height:50px;" class="form-control" id="message">test</textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Send</button>
|
||||
</form>
|
||||
<div id="log">
|
||||
|
||||
</div>
|
||||
<video id="video_player" width="40%" controls autoplay muted></video>
|
||||
</div>
|
||||
|
||||
<div>------------------------------------------------------------------------------------------------------------------------------</div>
|
||||
<div class="div_class_topArea">
|
||||
|
||||
<div class="div_class_recordControl">
|
||||
asr服务器地址(必填):
|
||||
<br>
|
||||
<input id="wssip" type="text" onchange="addresschange()" style="width: 500px;" value="wss://127.0.0.1:10197/"/>
|
||||
<br>
|
||||
<a id="wsslink" style="display: block;" href="#" onclick="window.open('https://127.0.0.1:10197/', '_blank')"><div id="info_wslink">点此处手工授权wss://127.0.0.1:10095/</div></a>
|
||||
<br>
|
||||
<br>
|
||||
<div style="border:2px solid #ccc;display: none;">
|
||||
选择录音模式:<br/>
|
||||
|
||||
<label ><input name="recoder_mode" onclick="on_recoder_mode_change()" type="radio" value="mic" checked="true"/>麦克风 </label>
|
||||
<label><input name="recoder_mode" onclick="on_recoder_mode_change()" type="radio" value="file" />文件 </label>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div id="mic_mode_div" style="border:2px solid #ccc;display:none;">
|
||||
选择asr模型模式:<br/>
|
||||
|
||||
<label><input name="asr_mode" type="radio" value="2pass" />2pass </label>
|
||||
<label><input name="asr_mode" type="radio" value="online" checked="true"/>online </label>
|
||||
<label><input name="asr_mode" type="radio" value="offline" />offline </label>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="rec_mode_div" style="border:2px solid #ccc;display:none;">
|
||||
|
||||
|
||||
<input type="file" id="upfile">
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div style="border:2px solid #ccc;display: none;">
|
||||
热词设置(一行一个关键字,空格隔开权重,如"阿里巴巴 20"):
|
||||
<br>
|
||||
<textarea rows="3" id="varHot" style=" width: 100%;height:100%" >阿里巴巴 20 hello world 40</textarea>
|
||||
<br>
|
||||
</div>
|
||||
语音识别结果显示:
|
||||
<br>
|
||||
|
||||
<textarea rows="10" id="varArea" readonly="true" style=" width: 100%;height:100%" ></textarea>
|
||||
<br>
|
||||
<div id="info_div">请点击开始</div>
|
||||
<div class="div_class_buttons">
|
||||
<button id="btnConnect">连接</button>
|
||||
<button id="btnStart">开始</button>
|
||||
<button id="btnStop">停止</button>
|
||||
|
||||
</div>
|
||||
|
||||
<audio id="audio_record" type="audio/wav" controls style="margin-top: 12px; width: 100%;"></audio>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="wsconnecter.js" charset="utf-8"></script>
|
||||
<script src="main.js" charset="utf-8"></script>
|
||||
|
||||
</body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
// $(document).ready(function() {
|
||||
// var host = window.location.hostname
|
||||
// var ws = new WebSocket("ws://"+host+":8000/humanecho");
|
||||
// //document.getElementsByTagName("video")[0].setAttribute("src", aa["video"]);
|
||||
// ws.onopen = function() {
|
||||
// console.log('Connected');
|
||||
// };
|
||||
// ws.onmessage = function(e) {
|
||||
// console.log('Received: ' + e.data);
|
||||
// data = e
|
||||
// var vid = JSON.parse(data.data);
|
||||
// console.log(typeof(vid),vid)
|
||||
// //document.getElementsByTagName("video")[0].setAttribute("src", vid["video"]);
|
||||
|
||||
// };
|
||||
// ws.onclose = function(e) {
|
||||
// console.log('Closed');
|
||||
// };
|
||||
|
||||
// flvPlayer = mpegts.createPlayer({type: 'flv', url: "http://"+host+":8080/live/livestream.flv", isLive: true, enableStashBuffer: false});
|
||||
// flvPlayer.attachMediaElement(document.getElementById('video_player'));
|
||||
// flvPlayer.load();
|
||||
// flvPlayer.play();
|
||||
|
||||
// $('#echo-form').on('submit', function(e) {
|
||||
// e.preventDefault();
|
||||
// var message = $('#message').val();
|
||||
// console.log('Sending: ' + message);
|
||||
// ws.send(message);
|
||||
// $('#message').val('');
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
</html>
|
|
@ -54,10 +54,10 @@ var totalsend=0;
|
|||
var now_ipaddress=window.location.href;
|
||||
now_ipaddress=now_ipaddress.replace("https://","wss://");
|
||||
now_ipaddress=now_ipaddress.replace("static/index.html","");
|
||||
var localport=window.location.port;
|
||||
now_ipaddress=now_ipaddress.replace(localport,"10095");
|
||||
document.getElementById('wssip').value=now_ipaddress;
|
||||
addresschange();
|
||||
// var localport=window.location.port;
|
||||
// now_ipaddress=now_ipaddress.replace(localport,"10095");
|
||||
// document.getElementById('wssip').value=now_ipaddress;
|
||||
// addresschange();
|
||||
function addresschange()
|
||||
{
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue