From bc723ea200144bd6fa8a5dff4b9a780feda144fc Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期四, 29 六月 2023 18:55:01 +0800
Subject: [PATCH] dcos
---
funasr/runtime/html5/readme.md | 125 +++++++++++++++--------------------------
1 files changed, 46 insertions(+), 79 deletions(-)
diff --git a/funasr/runtime/html5/readme.md b/funasr/runtime/html5/readme.md
index 92c63d3..0c1eba0 100644
--- a/funasr/runtime/html5/readme.md
+++ b/funasr/runtime/html5/readme.md
@@ -1,103 +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
-[html5褰曢煶](https://github.com/xiangyuecn/Recorder)
+### javascript (Optional)
+[html5 recorder.js](https://github.com/xiangyuecn/Recorder)
```shell
Recorder
```
-### demo椤甸潰濡備笅
-
+## demo
+<div align="center"><img src="./demo.gif" width="150"/> </div>
-## 鍏蜂綋鏁版嵁娴佸悜锛�
-娴忚鍣╤ttps楹﹀厠椋� --> html5 demo鏈嶅姟 --> js wss鎺ュ彛 --> nginx鏈嶅姟 --> ws asr online srv
-
-## 1.html5 demo鏈嶅姟鍚姩
-### 鍚姩html5鏈嶅姟锛岄渶瑕乻sl璇佷功(鑷繁鐢熸垚璇峰線鍚庣湅)
+## 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]
```
-## 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绔彛涓�
+`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)
-## 3.淇敼wsconnecter.js閲宎sr鎺ュ彛鍦板潃
-wsconnecter.js閲岄厤缃畂nline asr鏈嶅姟鍦板潃璺緞锛岃繖閲岄厤缃殑鏄痭ginx鐨剋ss绔彛)
-var Uri = "wss://xxx:xxx/"
+`Tips:` asr service and html5 service should be deployed on the same device.
+```shell
+cd ../python/websocket
+python wss_srv_asr.py --port 10095
+```
-## 4.閰嶇疆nginx骞跺惎鍔�
-## 5.娴忚鍣ㄦ墦寮�鍦板潃娴嬭瘯
+### open browser to access html5 demo
+```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
+# https://30.220.136.139:1337/static/index.html
```
-## nginx杞彂閰嶇疆绀轰緥
+### 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
-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 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.
\ No newline at end of file
--
Gitblit v1.9.1