使用Docker部署FunASR服务

使用Docker部署FunASR服务

说明:

创建Dockerfile:

FROM registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.10
ENV TZ=Asia/Shanghai
EXPOSE 10095/tcp 10095/tcp
COPY run.sh /run.sh
RUN chmod +x /run.sh
ENTRYPOINT ["/run.sh"]

构建镜像:

docker build . -t asr

其中run.sh文件:

#!/bin/bash

cd /workspace/FunASR/runtime
nohup bash run_server_2pass.sh \
  --download-model-dir /workspace/models \
  --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \
  --model-dir damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx  \
  --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx  \
  --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx \
  --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst \
  --itn-dir thuduj12/fst_itn_zh \
  --certfile 0  \
  --hotword /workspace/models/hotwords.txt > log.out 2>&1 & tail -f log.out

创建docker-compose.yaml文件:

version: "3.7"
services:
  funasronline:
    image: asr:latest
    container_name: funasronline
    restart: always
    privileged: true
    networks:
      - asrnet
    ports:
      - 10095:10095
    volumes:
      - "./funasr-runtime-resources/models:/workspace/models"

networks:
  asrnet:
    driver: bridge

其中image部分为刚刚构建的镜像。

启动服务:

docker compose up
posted @ 2024-08-26 16:55  shizidushu  阅读(192)  评论(0编辑  收藏  举报