Pārlūkot izejas kodu

docker自启动

mrh 1 gadu atpakaļ
vecāks
revīzija
5f884c608f
3 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 1 0
      docker-compose.yaml
  2. 2 0
      readme.md
  3. 4 1
      runtime/python/websocket/funasr_wss_client.py

+ 1 - 0
docker-compose.yaml

@@ -2,6 +2,7 @@ version: '3'
 services:  
   funasr:  
     image: registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.4  
+    restart: unless-stopped
     ports:  
       - "10095:10095"  
     volumes:  

+ 2 - 0
readme.md

@@ -45,6 +45,8 @@ pyinstaller -F /home/user/program/modelscope-whisper/FunASR/runtime/python/webso
 # 部署
 ## docker-compose(推荐)
 ```shell
+dc -f /home/mrh/program/asr/FunASR/docker-compose.yaml up -d
+dc -f /home/mrh/program/asr/FunASR/docker-compose.yaml logs -f
 # 在仓库 FunASR 目录中,使用 docker-compose.yaml 来启动容器
 docker-compose up -d 
 # 查看日志,是否运行成功

+ 4 - 1
runtime/python/websocket/funasr_wss_client.py

@@ -166,6 +166,7 @@ async def record_microphone():
 async def record_from_scp(chunk_begin, chunk_size):
     global voices
     is_finished = False
+    print(f"args: {args}")
     if args.audio_in.endswith(".scp"):
         f_scp = open(args.audio_in)
         wavs = f_scp.readlines()
@@ -191,7 +192,7 @@ async def record_from_scp(chunk_begin, chunk_size):
             hotword_msg = json.dumps(fst_dict)
         else:
             hotword_msg = args.hotword
-        print (hotword_msg)
+        print ("hotword_msg: ", hotword_msg)
 
     sample_rate = args.audio_fs
     wav_format = "pcm"
@@ -241,6 +242,7 @@ async def record_from_scp(chunk_begin, chunk_size):
                               "itn": use_itn})
 
         #voices.put(message)
+        print("send message")
         await websocket.send(message)
         is_speaking = True
         for i in range(chunk_num):
@@ -362,6 +364,7 @@ async def ws_client(id, chunk_begin, chunk_size, proc_args=None):
         print("connect to", uri)
         async with websockets.connect(uri, subprotocols=["binary"], ping_interval=None, ssl=ssl_context) as websocket:
             if args.audio_in is not None:
+                print(f"i = {i}")
                 task = asyncio.create_task(record_from_scp(i, 1))
             else:
                 task = asyncio.create_task(record_microphone())