From c2e4e3c2e9be855277d9f4fa9cd0544892ff829a Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 30 八月 2023 09:57:30 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add

---
 funasr/runtime/html5/readme.md |  160 +++++++++++++++++++++++++----------------------------
 1 files changed, 75 insertions(+), 85 deletions(-)

diff --git a/funasr/runtime/html5/readme.md b/funasr/runtime/html5/readme.md
index 92c63d3..2cde826 100644
--- a/funasr/runtime/html5/readme.md
+++ b/funasr/runtime/html5/readme.md
@@ -1,103 +1,93 @@
-# online asr demo for html5
+([绠�浣撲腑鏂嘳(./readme_zh.md)|English)
 
-## requirement
-### python
-```shell
-flask
-gevent
-pyOpenSSL
-```
+# Speech Recognition Service Html5 Client Access Interface
 
-### javascript
-[html5褰曢煶](https://github.com/xiangyuecn/Recorder)
-```shell
-Recorder 
-```
+The server deployment uses the websocket protocol. The client can support html5 webpage access and microphone input or file input. There are two ways to access the service:
+- Method 1: 
 
-### demo椤甸潰濡備笅
-![img](https://github.com/alibaba-damo-academy/FunASR/blob/for-html5-demo/funasr/runtime/html5/demo.gif)
+  Directly connect to the html client, manually download the client ([click here](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/html5/static)) to the local computer, and open the index.html webpage to enter the wss address and port number.
 
-## 鍏蜂綋鏁版嵁娴佸悜锛�
-娴忚鍣╤ttps楹﹀厠椋� --> html5 demo鏈嶅姟 --> js wss鎺ュ彛 --> nginx鏈嶅姟 --> ws asr online srv
+- Method 2: 
 
-## 1.html5 demo鏈嶅姟鍚姩
-### 鍚姩html5鏈嶅姟锛岄渶瑕乻sl璇佷功(鑷繁鐢熸垚璇峰線鍚庣湅)
+   Html5 server, automatically download the client to the local computer, and support access by mobile phones and other devices.
+
+## Starting Speech Recognition Service
+
+Support the deployment of Python and C++ versions, where
+
+- Python version
+  
+  Directly deploy the Python pipeline, support streaming real-time speech recognition models, offline speech recognition models, streaming offline integrated error correction models, and output text with punctuation marks. Single server, supporting a single client.
+
+- C++ version
+  
+  funasr-runtime-sdk, supports one-key deployment, version 0.1.0, supports offline file transcription. Single server, supporting requests from hundreds of clients.
+
+### Starting Python Version Service
+
+#### Install Dependencies
 
 ```shell
-usage: h5Server.py [-h] [--host HOST] [--port PORT] [--certfile CERTFILE]
-                   [--keyfile KEYFILE]
-python h5Server.py --port 1337
+pip3 install -U modelscope funasr flask
+# Users in mainland China, if encountering network issues, can install with the following command:
+# pip3 install -U modelscope funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple
+git clone https://github.com/alibaba/FunASR.git && cd FunASR
 ```
-## 2.鍚姩ws asr online srv
-[鍏蜂綋璇风湅online asr](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/websocket)
-鐩墠online asr鍙彁渚泈s鎺ュ彛锛岄渶瑕侀�氳繃nginx灏唚ss杞彂鍒拌online asr绔彛涓�
 
-## 3.淇敼wsconnecter.js閲宎sr鎺ュ彛鍦板潃
-wsconnecter.js閲岄厤缃畂nline asr鏈嶅姟鍦板潃璺緞锛岃繖閲岄厤缃殑鏄痭ginx鐨剋ss绔彛)
-var Uri = "wss://xxx:xxx/" 
+#### Start ASR Service
 
-## 4.閰嶇疆nginx骞跺惎鍔�
+#### wss Method
 
-## 5.娴忚鍣ㄦ墦寮�鍦板潃娴嬭瘯
+```shell
+cd funasr/runtime/python/websocket
+python funasr_wss_server.py --port 10095
+```
+
+For detailed parameter configuration and analysis, please click [here](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/websocket).
+
+#### Html5 Service (Optional)
+
+If you need to use the client method mentioned above to access it, you can start the html5 service
+
+```shell
+h5Server.py [-h] [--host HOST] [--port PORT] [--certfile CERTFILE] [--keyfile KEYFILE]             
+```
+As shown in the example below, pay attention to the IP address. If accessing from another device (such as a mobile phone), you need to set the IP address to the real public IP address.
+```shell
+cd funasr/runtime/html5
+python h5Server.py --host 0.0.0.0 --port 1337
+```
+
+After starting, enter ([https://127.0.0.1:1337/static/index.html](https://127.0.0.1:1337/static/index.html)) in the browser to access it.
+
+### Starting C++ Version Service
+
+Since there are many dependencies for C++, it is recommended to deploy it using docker, which supports one-key start of the service.
+
+
+```shell
+curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-offline-cpu-zh.sh;
+sudo bash funasr-runtime-deploy-offline-cpu-zh.sh install --workspace /root/funasr-runtime-resources
+```
+For detailed parameter configuration and analysis, please click [here](https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/docs/SDK_tutorial_zh.md).
+
+## Client Testing
+
+### Method 1
+
+Directly connect to the html client, manually download the client ([click here](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/html5/static)) to the local computer, and open the index.html webpage, enter the wss address and port number to use.
+
+### Method 2
+
+Html5 server, automatically download the client to the local computer, and support access by mobile phones and other devices. The IP address needs to be consistent with the html5 server. If it is a local computer, you can use 127.0.0.1.
+
+```shell
 https://127.0.0.1:1337/static/index.html
-
-
-
-
-
-## nginx閰嶇疆璇存槑(浜嗚В鐨勫彲浠ヨ烦杩�)
-h5鎵撳紑楹﹀厠椋庨渶瑕乭ttps鍗忚锛屽悓鏃跺悗绔殑asr websocket涔熷繀椤绘槸wss鍗忚锛岃�岀洰鍓峓online asr](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/websocket)妯″瀷鍙敮鎸亀s鍗忚锛屾墍浠ユ垜浠�氳繃nginx閰嶇疆瀹炵幇wss鍗忚鍒皐s鍗忚鐨勮浆鎹€��
-
-## 鑷鐢熸垚璇佷功
-鐢熸垚璇佷功(娉ㄦ剰杩欑璇佷功骞朵笉鑳借鎵�鏈夋祻瑙堝櫒璁ゅ彲锛岄儴鍒嗘墜鍔ㄦ巿鏉冨彲浠ヨ闂�,鏈�濂戒娇鐢ㄥ叾浠栬璇佺殑瀹樻柟ssl璇佷功)
-
-```shell
-### 1)鐢熸垚绉侀挜锛屾寜鐓ф彁绀哄~鍐欏唴瀹�
-openssl genrsa -des3 -out server.key 1024
- 
-### 2)鐢熸垚csr鏂囦欢 锛屾寜鐓ф彁绀哄~鍐欏唴瀹�
-openssl req -new -key server.key -out server.csr
- 
-### 鍘绘帀pass
-cp server.key server.key.org 
-openssl rsa -in server.key.org -out server.key
- 
-### 鐢熸垚crt鏂囦欢锛屾湁鏁堟湡1骞达紙365澶╋級
-openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
 ```
 
-## nginx杞彂閰嶇疆绀轰緥
-```shell
-events {                                                                                                            [0/1548]
-    worker_connections  1024;
-    accept_mutex on;
-  }
-http {
-  error_log  error.log;
-  access_log  access.log;
-  server {
+Enter the wss address and port number to use.
 
-    listen 5921 ssl http2;  # nginx listen port for wss
-    server_name www.test.com;
-
-    ssl_certificate     /funasr/server.crt;
-    ssl_certificate_key /funasr/server.key;
-    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
-    ssl_ciphers         HIGH:!aNULL:!MD5;
-
-    location /wss/ {
-
-
-      proxy_pass http://127.0.0.1:1111/;  # asr online model ws address and port
-      proxy_http_version 1.1;
-      proxy_set_header Upgrade $http_upgrade;
-      proxy_set_header Connection "upgrade";
-      proxy_read_timeout 600s;
-
-    }
-  }
-```
 
 ## Acknowledge
 1. This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR).
-2. We acknowledge [鐖卞尰澹癩(http://www.aihealthx.com/) for contributing the html5 demo.
\ No newline at end of file
+2. We acknowledge [AiHealthx](http://www.aihealthx.com/) for contributing the html5 demo.

--
Gitblit v1.9.1