Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

vad

游雁174053cfca1e
diff --git a/funasr/bin/vad_inference.py b/funasr/bin/vad_inference.py
index 2945c94ae..08d65a4e7 100644
--- a/funasr/bin/vad_inference.py
+++ b/funasr/bin/vad_inference.py
@@ -1,5 +1,6 @@
import argparse
import logging
+import os
import sys
import json
from pathlib import Path
@@ -266,7 +267,8 @@ def inference_modelscope(
# do vad segment
_, results = speech2vadsegment(**batch)
for i, _ in enumerate(keys):
- # results[i] = json.dumps(results[i])
+ if "MODELSCOPE_ENVIRONMENT" in os.environ and os.environ["MODELSCOPE_ENVIRONMENT"] == "eas":
+ results[i] = json.dumps(results[i])
item = {'key': keys[i], 'value': results[i]}
vad_results.append(item)
if writer is not None:
diff --git a/funasr/bin/vad_inference_online.py b/funasr/bin/vad_inference_online.py
index bc1e15b22..faee1fc00 100644
--- a/funasr/bin/vad_inference_online.py
+++ b/funasr/bin/vad_inference_online.py
@@ -1,5 +1,6 @@
import argparse
import logging
+import os
import sys
import json
from pathlib import Path
@@ -237,7 +238,8 @@ def inference_modelscope(
if results:
for i, _ in enumerate(keys):
if results[i]:
- # results[i] = json.dumps(results[i])
+ if "MODELSCOPE_ENVIRONMENT" in os.environ and os.environ["MODELSCOPE_ENVIRONMENT"] == "eas":
+ results[i] = json.dumps(results[i])
item = {'key': keys[i], 'value': results[i]}
vad_results.append(item)
if writer is not None: