[PR #795] [CLOSED] add funasr for asr feature #22693

Closed
opened 2026-02-21 20:19:32 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify/pull/795
Author: @lingfengchencn
Created: 8/10/2023
Status: Closed

Base: mainHead: feat/funasr


📝 Commits (1)

  • aa21791 add funasr for asr feature,use config from app_model_configs.speech_to_text['model'

📊 Changes

13 files changed (+206 additions, -37 deletions)

View changed files

📝 api/constants/model_template.py (+4 -0)
📝 api/controllers/console/app/audio.py (+15 -5)
📝 api/controllers/console/universal_chat/audio.py (+14 -6)
📝 api/controllers/service_api/app/audio.py (+14 -5)
📝 api/controllers/web/audio.py (+13 -5)
api/core/audio/asr/base.py (+14 -0)
api/core/audio/asr/para_asr.py (+84 -0)
📝 api/core/audio/asr/whisper.py (+2 -2)
📝 api/requirements.txt (+4 -1)
📝 api/services/audio_service.py (+28 -13)
api/tests/core/__init__.py (+0 -0)
api/tests/core/audio/__init__.py (+0 -0)
api/tests/core/audio/asr/test_paraformer.py (+14 -0)

📄 Description

use funasr onnx to transcribe audio file use config from database

AppModelConfig.speech_to_text
{"enabled": true, "model":"funasr"}

or

{"enabled": false, "model": "whisper-1"}

add python requirements.txt

funasr_onnx
funasr

use models from modelscope funasr:

damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch
damo/speech_fsmn_vad_zh-cn-16k-common-pytorch

test code:

python -m unittest tests/core/asr/test_funasr.py

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify/pull/795 **Author:** [@lingfengchencn](https://github.com/lingfengchencn) **Created:** 8/10/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/funasr` --- ### 📝 Commits (1) - [`aa21791`](https://github.com/langgenius/dify/commit/aa2179117b58384d7a3ec7525f0afb3a441c91b6) add funasr for asr feature,use config from `app_model_configs.speech_to_text['model'` ### 📊 Changes **13 files changed** (+206 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `api/constants/model_template.py` (+4 -0) 📝 `api/controllers/console/app/audio.py` (+15 -5) 📝 `api/controllers/console/universal_chat/audio.py` (+14 -6) 📝 `api/controllers/service_api/app/audio.py` (+14 -5) 📝 `api/controllers/web/audio.py` (+13 -5) ➕ `api/core/audio/asr/base.py` (+14 -0) ➕ `api/core/audio/asr/para_asr.py` (+84 -0) 📝 `api/core/audio/asr/whisper.py` (+2 -2) 📝 `api/requirements.txt` (+4 -1) 📝 `api/services/audio_service.py` (+28 -13) ➕ `api/tests/core/__init__.py` (+0 -0) ➕ `api/tests/core/audio/__init__.py` (+0 -0) ➕ `api/tests/core/audio/asr/test_paraformer.py` (+14 -0) </details> ### 📄 Description use `funasr onnx` to transcribe audio file use config from database ```python AppModelConfig.speech_to_text ``` ```json {"enabled": true, "model":"funasr"} ``` or ```json {"enabled": false, "model": "whisper-1"} ``` add python requirements.txt ``` funasr_onnx funasr ``` use models from `modelscope` funasr: ``` damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch damo/speech_fsmn_vad_zh-cn-16k-common-pytorch ``` test code: ```python python -m unittest tests/core/asr/test_funasr.py ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-21 20:19:32 -05:00
yindo closed this issue 2026-02-21 20:19:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22693