编辑 | blame | 历史 | 原始文档

Html5 server for asr service

Requirement

Install the modelscope and funasr

pip install -U modelscope funasr
# For the users in China, you could install with the command:
# pip install -U modelscope funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple
git clone https://github.com/alibaba/FunASR.git && cd FunASR

Install the requirements for server

pip install flask
# pip install gevent (Optional)
# pip install pyOpenSSL (Optional)

javascript (Optional)

html5录音
shell Recorder

demo页面如下

操作步骤

html5 demo服务启动

启动html5服务,需要ssl证书(已生成,如需要自己生成请往后看)
shell h5Server.py [-h] [--host HOST] [--port PORT] [--certfile CERTFILE] [--keyfile KEYFILE]
例子如下,需要注意ip地址,如果从其他设备访问需求(例如手机端),需要将ip地址设为真实ip
shell cd funasr/runtime/html5 python h5Server.py --host 0.0.0.0 --port 1337 # python h5Server.py --host 30.220.136.139 --port 1337

启动ASR服务

具体请看online asr

Tips: asr 服务需要与html5服务部署到同一个物理机器上

wss方式

cd ../python/websocket
python funasr_wss_server.py --port 10095

浏览器打开地址

ip地址需要与html5 server保持一致,如果是本地机器,可以用127.0.0.1
shell https://127.0.0.1:1337/static/index.html # https://30.220.136.139:1337/static/index.html

修改网页里asr接口地址

修改网页中,asr服务器地址(websocket srv的ip与端口),点击开始即可使用。注意h5服务和asr服务需要在同一个服务器上,否则存在跨域问题。

Acknowledge

  1. This project is maintained by FunASR community.
  2. We acknowledge AiHealthx for contributing the html5 demo.