Add entry for GUI and revise readme

pull/529/head
babysor00 3 years ago
parent 9b4f8cc6c9
commit c04a1097bf

@ -82,15 +82,10 @@
### 3. 启动程序或工具箱
您可以尝试使用以下命令:
### 3.1 启动Web程序
### 3.1 启动Web程序v2
`python web.py`
运行成功后在浏览器打开地址, 默认为 `http://localhost:8080`
![123](https://user-images.githubusercontent.com/12797292/135494044-ae59181c-fe3a-406f-9c7d-d21d12fdb4cb.png)
> 注目前界面比较buggy,
> * 第一次点击`录制`要等待几秒浏览器正常启动录音,否则会有重音
> * 录制结束不要再点`录制`而是`停止`
> * 仅支持手动新录音16khz, 不支持超过4MB的录音最佳长度在5~15秒
> * 默认使用第一个找到的模型,有动手能力的可以看代码修改 `web\__init__.py`
### 3.2 启动工具箱:
`python demo_toolbox.py -d <datasets_root>`

@ -1,21 +0,0 @@
import os
import sys
import typer
cli = typer.Typer()
@cli.command()
def launch_ui(port: int = typer.Option(8051, "--port", "-p")) -> None:
"""Start a graphical UI server for the opyrator.
The UI is auto-generated from the input- and output-schema of the given function.
"""
# Add the current working directory to the sys path
# This is required to resolve the opyrator path
sys.path.append(os.getcwd())
from mkgui.base.ui.streamlit_ui import launch_ui
launch_ui(port)
if __name__ == "__main__":
cli()

@ -1,11 +1,21 @@
from web import webApp
from gevent import pywsgi as wsgi
import os
import sys
import typer
cli = typer.Typer()
@cli.command()
def launch_ui(port: int = typer.Option(8080, "--port", "-p")) -> None:
"""Start a graphical UI server for the opyrator.
The UI is auto-generated from the input- and output-schema of the given function.
"""
# Add the current working directory to the sys path
# This is required to resolve the opyrator path
sys.path.append(os.getcwd())
from mkgui.base.ui.streamlit_ui import launch_ui
launch_ui(port)
if __name__ == "__main__":
app = webApp()
host = app.config.get("HOST")
port = app.config.get("PORT")
print(f"Web server: http://{host}:{port}")
server = wsgi.WSGIServer((host, port), app)
server.serve_forever()
cli()
Loading…
Cancel
Save