Skip to content

Commit fefacc6

Browse files
authored
Merge pull request #5 from pymss-project/server
Server
2 parents b4a2902 + b2d7db9 commit fefacc6

132 files changed

Lines changed: 9743 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ jobs:
2222
with:
2323
python-version: "3.11"
2424

25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: "22"
29+
cache: npm
30+
cache-dependency-path: webui/package-lock.json
31+
32+
- name: Install WebUI dependencies
33+
run: npm ci
34+
working-directory: webui
35+
36+
- name: Build WebUI static assets
37+
run: npm run build
38+
working-directory: webui
39+
2540
- name: Install build tools
2641
run: python -m pip install --upgrade pip build twine
2742

.github/workflows/webui-assets.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: WebUI Assets
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "webui/**"
7+
- "pymss/server/webui_static/**"
8+
- ".github/workflows/webui-assets.yml"
9+
push:
10+
branches:
11+
- "**"
12+
paths:
13+
- "webui/**"
14+
- "pymss/server/webui_static/**"
15+
- ".github/workflows/webui-assets.yml"
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
check-webui-assets:
23+
name: Check generated WebUI assets
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Check out repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: "22"
34+
cache: npm
35+
cache-dependency-path: webui/package-lock.json
36+
37+
- name: Install WebUI dependencies
38+
run: npm ci
39+
working-directory: webui
40+
41+
- name: Build WebUI static assets
42+
run: npm run build
43+
working-directory: webui
44+
45+
- name: Check generated assets are committed
46+
run: |
47+
if ! git diff --exit-code -- pymss/server/webui_static; then
48+
echo "::error::WebUI static assets are out of date. Run 'npm ci && npm run build' in webui and commit pymss/server/webui_static/."
49+
exit 1
50+
fi

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ coverage.xml
5151
.pytest_cache/
5252
cover/
5353

54+
# Node / frontend
55+
webui/node_modules/
56+
!webui/src/lib/
57+
!webui/src/lib/**
58+
5459
# Translations
5560
*.mo
5661
*.pot
@@ -184,4 +189,4 @@ pretrain
184189
resources
185190
tmp
186191
all_models
187-
/mps/
192+
/mps/

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ pymss --model-dir /path/to/models infer bs_roformer_voc_hyperacev2 \
5656

5757
When running from a source checkout without installation, use `python -m pymss.cli` instead of `pymss`.
5858

59+
### Server and WebUI
60+
61+
Install the optional server dependencies to run a HTTP server with dynamic model loading, catalog browsing, model downloads, and an optional browser WebUI:
62+
63+
```sh
64+
pip install "pymss[server]"
65+
pymss serve --webui
66+
```
67+
68+
See [server CLI docs](./docs/server/cli.md), [server API docs](./docs/server/api.md), and [server error docs](./docs/server/errors.md) for details.
69+
5970
### Python API
6071

6172
Use a catalog model name directly. You do not need to pass `model_type`, `model_path`, or `config_path`.

README_CN.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ pymss --model-dir /path/to/models infer bs_roformer_voc_hyperacev2 \
5151

5252
如果是在源码目录里未安装运行,可以用 `python -m pymss.cli` 代替 `pymss`
5353

54+
### Server 和 WebUI
55+
56+
安装可选 server 依赖后,可以启动 HTTP server,支持动态加载模型、浏览 catalog、下载模型文件,以及可选的浏览器 WebUI:
57+
58+
```sh
59+
pip install "pymss[server]"
60+
pymss serve --webui
61+
```
62+
63+
详细用法见 [server CLI 文档](./docs/server/cli.md)[server API 文档](./docs/server/api.md)[server 错误文档](./docs/server/errors.md)
64+
5465
### Python API
5566

5667
直接用 catalog 里的模型名即可,不需要传 `model_type``model_path``config_path`

0 commit comments

Comments
 (0)