雾聪
2023-08-20 a4833f38c41c9c5998f45db7b0884e10498605ec
Merge branch 'main' of https://github.com/alibaba-damo-academy/FunASR into main
4个文件已修改
25 ■■■■ 已修改文件
funasr/runtime/docs/docker_offline_cpu_zh_lists 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/html5/static/main.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/html5/static/wsconnecter.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/java/FunasrWsClient.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/docs/docker_offline_cpu_zh_lists
@@ -2,8 +2,6 @@
  funasr-runtime-sdk-cpu-0.1.0
DEFAULT_ASR_MODEL:
  damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx
  damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx
  damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404-onnx
DEFAULT_VAD_MODEL:
  damo/speech_fsmn_vad_zh-cn-16k-common-onnx
DEFAULT_PUNC_MODEL:
funasr/runtime/html5/static/main.js
@@ -44,6 +44,7 @@
 
var isfilemode=false;  // if it is in file mode
var file_ext="";
var file_data_array;  // array to save file data
 
var totalsend=0;
@@ -81,6 +82,10 @@
            for(let i = 0; i < len; i++) {
                let fileAudio = new FileReader();
                fileAudio.readAsArrayBuffer(this.files[i]);  
                file_ext=this.files[i].name.split('.').pop().toLowerCase();
                if(file_ext==="wav"){
                    file_ext="pcm";
                }
                fileAudio.onload = function() {
                 var audioblob= fileAudio.result;
                 file_data_array=audioblob;
funasr/runtime/html5/static/wsconnecter.js
@@ -72,7 +72,12 @@
            "is_speaking":  true,
            "chunk_interval":10,
            "mode":getAsrMode(),
        };
        if(isfilemode)
        {
            request.wav_format=file_ext;
        }
        console.log(request);
        speechSokt.send( JSON.stringify(request) );
        console.log("连接成功");
funasr/runtime/java/FunasrWsClient.java
@@ -50,7 +50,8 @@
  }
  public FunasrWsClient(URI serverURI) {
    super(serverURI);
    super(serverURI);
  }
  public FunasrWsClient(URI serverUri, Map<String, String> httpHeaders) {
@@ -64,7 +65,7 @@
  // send json at first time
  public void sendJson(
      String mode, String strChunkSize, int chunkInterval, String wavName, boolean isSpeaking) {
      String mode, String strChunkSize, int chunkInterval, String wavName, boolean isSpeaking,String suffix) {
    try {
      JSONObject obj = new JSONObject();
@@ -78,6 +79,10 @@
      obj.put("chunk_size", array);
      obj.put("chunk_interval", new Integer(chunkInterval));
      obj.put("wav_name", wavName);
      if(suffix.equals("wav")){
          suffix="pcm";
      }
      obj.put("wav_format", suffix);
      if (isSpeaking) {
        obj.put("is_speaking", new Boolean(true));
      } else {
@@ -114,7 +119,9 @@
  // function for rec wav file
  public void recWav() {
    sendJson(mode, strChunkSize, chunkInterval, wavName, true);
    String fileName=FunasrWsClient.wavPath;
    String suffix=fileName.split("\\.")[fileName.split("\\.").length-1];
    sendJson(mode, strChunkSize, chunkInterval, wavName, true,suffix);
    File file = new File(FunasrWsClient.wavPath);
    int chunkSize = sendChunkSize;