From 54931dd4e1a099d7d6f144c4e12e5453deb3aa26 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期三, 28 六月 2023 10:41:57 +0800
Subject: [PATCH] Merge branch 'main' of https://github.com/alibaba-damo-academy/FunASR into main

---
 funasr/runtime/html5/readme.md |  131 ++++++++++++++++++-------------------------
 1 files changed, 55 insertions(+), 76 deletions(-)

diff --git a/funasr/runtime/html5/readme.md b/funasr/runtime/html5/readme.md
index 917865b..0c1eba0 100644
--- a/funasr/runtime/html5/readme.md
+++ b/funasr/runtime/html5/readme.md
@@ -1,91 +1,70 @@
-# online asr demo for html5
+# Html5 server for asr service
 
-## requirement
-### python
+## Requirement
+#### Install the modelscope and funasr
 ```shell
-flask
-gevent
-pyOpenSSL
+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
+```shell
+pip install flask
+# pip install gevent (Optional)
+# pip install pyOpenSSL (Optional)
 ```
 
-### javascript
+### javascript (Optional)
+[html5 recorder.js](https://github.com/xiangyuecn/Recorder)
 ```shell
-Recorder [html5褰曢煶](https://github.com/xiangyuecn/Recorder)
+Recorder 
 ```
-## html5鏈嶅姟閰嶇疆
-### 鍚姩html5鏈嶅姟
+
+## demo
+<div align="center"><img src="./demo.gif" width="150"/> </div>
+
+## Steps
+### Html5 demo
 
 ```shell
-usage: h5Server.py [-h] [--host HOST] [--port PORT] [--certfile CERTFILE]
-                   [--keyfile KEYFILE]
-python h5Server.py --port 1337
+usage: h5Server.py [-h] [--host HOST] [--port PORT] [--certfile CERTFILE] [--keyfile KEYFILE]
 ```
-娉�:
-wsconnecter.js閲岄厤缃畂nline asr wss璺緞
-var Uri = "wss://xxx:xxx/" 
+`e.g.`
+```shell
+cd funasr/runtime/html5
+python h5Server.py --host 0.0.0.0 --port 1337 
+```
+### asr service
+[detail for asr](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/websocket)
 
-### 娴忚鍣ㄦ墦寮�鍦板潃
+`Tips:` asr service and html5 service should be deployed on the same device.
+```shell
+cd ../python/websocket
+python wss_srv_asr.py --port 10095
+```
+
+
+### open browser to access html5 demo
+```shell
 https://127.0.0.1:1337/static/index.html
-
-
-### demo椤甸潰濡備笅
-![img](https://github.com/zhaomingwork/FunASR/tree/for-html5-demo/funasr/runtime/html5/demo.gif)
-
-
-##鍚庣閰嶇疆
-h5鎵撳紑楹﹀厠椋庨渶瑕乭ttps鍗忚锛屽悓鏃跺悗绔殑asr websocket涔熷繀椤绘槸wss鍗忚锛岃�岀洰鍓峓online asr](https://github.com/alibaba-damo-academy/FunASR/tree/main/funasr/runtime/python/websocket)妯″瀷鍙敮鎸亀s鍗忚锛屾墍浠ユ垜浠�氳繃nginx閰嶇疆瀹炵幇wss鍗忚鍒皐s鍗忚鐨勮浆鎹€��
-
-##鍏蜂綋杩囩▼濡備笅锛�
-娴忚鍣╤tts --> html5 demo鏈嶅姟 --> js wss鎺ュ彛 --> nginx鏈嶅姟 --> ws asr online srv
-
-##閰嶇疆nginx wss鍗忚(浜嗚В鐨勫彲浠ヨ烦杩囷級
-鐢熸垚璇佷功(娉ㄦ剰杩欑璇佷功骞朵笉鑳借鎵�鏈夋祻瑙堝櫒璁ゅ彲锛岄儴鍒嗘墜鍔ㄦ巿鏉冨彲浠ヨ闂�,鏈�濂戒娇鐢ㄥ叾浠栬璇佺殑瀹樻柟ssl璇佷功)
-
-### 鐢熸垚绉侀挜锛屾寜鐓ф彁绀哄~鍐欏唴瀹�
-openssl genrsa -des3 -out server.key 1024
- 
-### 鐢熸垚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 {
-
-    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:port
-      proxy_http_version 1.1;
-      proxy_set_header Upgrade $http_upgrade;
-      proxy_set_header Connection "upgrade";
-      proxy_read_timeout 600s;
-
-    }
-  }
+# https://30.220.136.139:1337/static/index.html
 ```
+
+### open browser to open html5 file directly without h5Server
+you can run html5 client by just clicking the index.html file directly in your computer.
+1) lauch asr service without ssl, it must be in ws mode as ssl protocol will prohibit such access.
+2) copy whole directory /funasr/runtime/html5/static to your computer
+3) open /funasr/runtime/html5/static/index.html by browser
+4) enter asr service ws address and connect
+
+
+```shell
+
+```
+ 
+
 
 ## 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.
\ No newline at end of file

--
Gitblit v1.9.1