Giter VIP home page Giter VIP logo

voice's Introduction

[TOC]

Voice

image-20240321223023658

基于开源项目 CapsWriter 二次开发,非常感谢这位作者的无私奉献

$\color{#FF0000}{本项目仅用于研究语音验证码的识别,请勿用于非法,出问题作者不承担任何责任}$

$\color{#FF0000}{不支持长音频识别}$​,需要使用长音频识别请使用 CapsWriter

支持 中英 两张语言识别

个人建议不启用标点模型(因为太慢了,也没啥用)

服务器请选择GPU服务器个人测试到 没有GPU的服务器好慢

处理器 显卡 速度
I7-11800H @ 2.3GHz RTX 3050 毫秒级(看上图 没具体测试) 个人的笔记本
Inter Xeon Gold 6148 @ 2.4GHz 10s 以上 服务器

测试对 某验,某象 的语音验证码识别是没有问题的

食用方法

无论是源码方式还是懒人包都需要下载模型

默认加载所有语音模型 不需要的请修改配置文件:

ParaFormerPath_En: Null  # 英文语音模型
TokensPath_En: Null  # 英文语音模型

1.**推荐** 源码安装方式(windows + python 3.10)

pip install -r requirements.txt
python main.py

2. 懒人包方法(打包的不是最新的版本哈 推荐使用源码自行打包)

懒人包由 nuitka 编译

直接运行 VoiceServer.exe 文件

3. nuitka 打包教程(windows)

需要先安装 nuitka

pip install nuitka
nuitka --onefile --standalone --include-package=uvicorn --include-package=fastapi --nofollow-import-to=*.test --nofollow-import-to=numba --noinclude-default-mode=error --enable-plugin=upx --jobs=16 --output-dir=build --windows-icon-from-ico=./resource/logo.ico --output-filename=VoiceServer .\main.py

配置文件说明

配置文件名:startup_param.yaml

host: '0.0.0.0'  # 监听地址
port: 4563  # 监听端口
title: VoiceServer # 标题
SaveCache: False # 保存文件缓存
ForMatPunc: False  # 处理标点符号(开启这个会加载标点模型)
ForMatSpell: True # 处理空格
ForMatNum: True # 转换数字
ModelPath: ./models # 模型文件夹
ParaFormerPath_Zh: ${ModelPath}/paraformer-offline-zh/model.onnx  # 中文语音模型
TokensPath_Zh: ${ModelPath}/paraformer-offline-zh/tokens.txt  # 中文语音模型
#ParaFormerPath_En: ${ModelPath}/paraformer-offline-en/model.onnx  # 英文语音模型
#TokensPath_En: ${ModelPath}/paraformer-offline-en/tokens.txt  # 英文语音模型
ParaFormerPath_En: Null  # 英文语音模型
TokensPath_En: Null  # 英文语音模型
PuncModelPath: ${ModelPath}/punc_ct-transformer_cn-en  # 标点模型

调用方式

POST /api/asr HTTP/1.1
Content-Type: application/json

{"Language":"zh","HotWords":"","UpFile_B64":""}

请求地址

POST /api/asr

请求头

参数名 类型 描述 必填
content-type string application/json

请求参数

参数名 类型 描述 必填
Language string 语言类型 默认zh
HotWords string 热词列表 使用逗号(,)分割
UpFile_B64 string 音频文件的base64编码

成功返回

参数名 类型 描述 必填
code int 错误码 正确 200 大于200失败
result dict 结果信息
message string 错误信息

result详细

参数名 类型 描述 必填
timestamps list 每个文字对应的时间点
tokens list 文字列表
duration float 音频文件时长
text string 最后的返回结果(包括热词处理后的)

python 请求示例

import base64
import requests

AudioFile = b''

result = requests.post('http://127.0.0.1/api/asr', json={
    'Language': 'zh',
    'HotWords': '',
    'UpFile_B64': base64.b64encode(AudioFile).decode()
}, headers={
    'Content-Type': 'application/json'
})
print(result)

打赏

非常感谢你的支持

wx

voice's People

Contributors

liangliang0107 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.