Browse Source

Merge pull request #222 from alibaba-damo-academy/dev_zly

fix the output of vad_results is null
hnluo 3 năm trước cách đây
mục cha
commit
ea5ff2de19
1 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 7 6
      funasr/bin/vad_inference_online.py

+ 7 - 6
funasr/bin/vad_inference_online.py

@@ -236,12 +236,13 @@ def inference_modelscope(
             # param_dict['in_cache'] = batch['in_cache']
             if results:
                 for i, _ in enumerate(keys):
-                    results[i] = json.dumps(results[i])
-                    item = {'key': keys[i], 'value': results[i]}
-                    vad_results.append(item)
-                    if writer is not None:
-                        results[i] = json.loads(results[i])
-                        ibest_writer["text"][keys[i]] = "{}".format(results[i])
+                    if results[i]:
+                        results[i] = json.dumps(results[i])
+                        item = {'key': keys[i], 'value': results[i]}
+                        vad_results.append(item)
+                        if writer is not None:
+                            results[i] = json.loads(results[i])
+                            ibest_writer["text"][keys[i]] = "{}".format(results[i])
 
         return vad_results