From 9728dfa2ec8c48d9f51396e63a3e622a51f807ed Mon Sep 17 00:00:00 2001 From: Bob Yang <31271515+hermitgreen@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:48:53 +0800 Subject: [PATCH] =?UTF-8?q?ASR=20FC=20bad=20case=E5=85=9C=E5=BA=95=20(#208?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 植物识别fc bad case工程兜底 * 植物识别, 动物识别, 图像内容理解 fc bad case工程兜底 * 音频识别 fc bad case 兜底 * 音频识别 fc bad case 兜底 * 音频识别 fc bad case 兜底 --- appbuilder/core/components/asr/component.py | 7 ++++--- appbuilder/core/components/object_recognize/component.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/appbuilder/core/components/asr/component.py b/appbuilder/core/components/asr/component.py index 754274c45..7da3d5445 100644 --- a/appbuilder/core/components/asr/component.py +++ b/appbuilder/core/components/asr/component.py @@ -20,6 +20,7 @@ import proto import requests +from urllib.parse import urlparse from appbuilder.core import utils from appbuilder.core.component import Component @@ -180,9 +181,9 @@ def tool_eval(self, name: str, streaming: bool, **kwargs): file_url = file_urls.get(file_name, None) if not file_url: raise InvalidRequestArgumentError(f"file {file_url} url does not exist") - file_type = kwargs.get("file_type", "wav") - if file_type not in ["pcm", "wav", "amr", "m4a"]: - file_type = "wav" + + _, file_type = os.path.splitext(os.path.basename(urlparse(file_url).path)) + req = ShortSpeechRecognitionRequest() req.speech = requests.get(file_url).content req.format = file_type diff --git a/appbuilder/core/components/object_recognize/component.py b/appbuilder/core/components/object_recognize/component.py index 405fafb77..f54f582d0 100644 --- a/appbuilder/core/components/object_recognize/component.py +++ b/appbuilder/core/components/object_recognize/component.py @@ -167,7 +167,7 @@ def tool_eval(self, name: str, streaming: bool, **kwargs): if item["score"] < score_threshold and len(results) > 0: continue res = { - "物品名称": item["keyword"], + "物体或场景名称": item["keyword"], "置信度": item["score"], "所属类别": item["root"], }