Davidliu преди 1 месец
родител
ревизия
1c24282fcb
променени са 1 файла, в които са добавени 9 реда и са изтрити 8 реда
  1. 9 8
      src/core/voip/asr.py

+ 9 - 8
src/core/voip/asr.py

@@ -11,14 +11,6 @@ from aliyunsdkcore.client import AcsClient
 from aliyunsdkcore.request import CommonRequest
 import time
 
-import hashlib
-import hmac
-import base64
-# from socket import *
-# import json, time, threading
-from websocket import create_connection
-# import websocket
-from urllib.parse import quote
 
 # 定义实时转写类
 class TestSt:
@@ -184,6 +176,15 @@ class TestSt:
 # 讯飞ASR实时转写
 class XfAsr:
     def __init__(self, tid, logger, message_receiver=None):
+        import hashlib
+        import hmac
+        import base64
+        # from socket import *
+        # import json, time, threading
+        from websocket import create_connection
+        # import websocket
+        from urllib.parse import quote
+
         app_id = "1ec1097b"
         api_key = "60b7d2d8d172b065b1c3e723e5ba0696"
         base_url = "ws://rtasr.xfyun.cn/v1/ws"