Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate ant design #32

Merged
merged 53 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
620b11f
feat: integrate ant design
Col0ring Sep 13, 2024
947cb38
fix: file path
Col0ring Sep 13, 2024
5ec3331
fix: ci
Col0ring Sep 13, 2024
77155b5
fix: component entry
Col0ring Sep 13, 2024
25b80cc
fix: change exposed component name
Col0ring Sep 14, 2024
3da95d4
chore: monorepo
Col0ring Sep 14, 2024
4a46970
feat: changeset pre version
Col0ring Sep 14, 2024
2dca8b8
chore: update beta versions
Col0ring Sep 14, 2024
9649071
fix: support Python 3.8
Col0ring Sep 14, 2024
a98387e
Merge remote-tracking branch 'origin/main' into feat/antd
Col0ring Sep 18, 2024
a794dd3
fix: changelog
Col0ring Sep 18, 2024
080c8cc
feat: add context value to Each
Col0ring Sep 18, 2024
ed8aeb9
feat: integrate Application and Lifecycle
Col0ring Sep 23, 2024
c152e5e
feat: handle rest props
Col0ring Sep 23, 2024
6a9d2fd
feat: update to antd 5.21.0
Col0ring Sep 24, 2024
c49a8e1
feat: resolve rest props
Col0ring Sep 25, 2024
023317e
fix: duplicate
Col0ring Sep 25, 2024
d874a4f
fix: float button
Col0ring Sep 30, 2024
093404a
feat: clone react element
Col0ring Oct 8, 2024
e8e3dd8
feat: migrate to gradio 5
Col0ring Oct 10, 2024
334d7bf
feat: add slot params
Col0ring Oct 11, 2024
11c1c1c
feat: complete the render function for slots
Col0ring Oct 15, 2024
24262bc
feat: add docs in code
Col0ring Oct 15, 2024
025f728
feat: migrate to gradio 5
Col0ring Oct 15, 2024
c2aaa16
chore: update versions
Col0ring Oct 15, 2024
badca56
refactor: data components
Col0ring Oct 21, 2024
eb7fec0
feat: add root class name
Col0ring Oct 22, 2024
d5fd6d1
fix: ts lint
Col0ring Oct 22, 2024
2882753
feat: params for data entry components
Col0ring Oct 29, 2024
9e5da52
feat: complete components params in Python
Col0ring Oct 31, 2024
b727d59
chore: update versions
Col0ring Oct 31, 2024
30b501a
fix: ms_globals
Col0ring Nov 1, 2024
b423d9d
feat: update
Col0ring Nov 4, 2024
a0176a5
fix: lint
Col0ring Nov 4, 2024
f28deb1
docs: build docs
Col0ring Nov 4, 2024
b0feb6c
docs: update layout
Col0ring Nov 4, 2024
7e04c6b
feat: update docs
Col0ring Nov 5, 2024
8092181
docs: migrating legacy docs
Col0ring Nov 5, 2024
73d20be
docs: lazy load
Col0ring Nov 6, 2024
c5187f0
docs: overview
Col0ring Nov 6, 2024
dfcb18b
fix: compatible input method languages
Col0ring Nov 7, 2024
fd65f6e
docs: update
Col0ring Nov 7, 2024
53b4f51
docs: update
Col0ring Nov 7, 2024
d726b2e
feat: Each and context value handler
Col0ring Nov 8, 2024
3b85264
docs: update readme
Col0ring Nov 8, 2024
96a0557
docs: update readme
Col0ring Nov 8, 2024
9f3c59c
feat: add new features
Col0ring Nov 8, 2024
c20ef7f
chore: update versions
Col0ring Nov 8, 2024
4c07851
docs: update
Col0ring Nov 11, 2024
bd4bbbc
docs: update
Col0ring Nov 11, 2024
8cbbf14
docs: update
Col0ring Nov 11, 2024
fa69665
docs: update
Col0ring Nov 11, 2024
05d6355
Merge branch 'main' into feat/antd
Col0ring Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 17 additions & 0 deletions .changeset/five-actors-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@modelscope-studio/legacy-waterfall-gallery': patch
'@modelscope-studio/legacy-multimodal-input': patch
'@modelscope-studio/legacy-lifecycle': patch
'@modelscope-studio/legacy-markdown': patch
'@modelscope-studio/legacy-compiled': patch
'@modelscope-studio/legacy-chatbot': patch
'@modelscope-studio/legacy-flow': patch
'@modelscope-studio/lint-config': patch
'@modelscope-studio/changelog': patch
'@modelscope-studio/antd': patch
'@modelscope-studio/base': patch
'@modelscope-studio/frontend': patch
'modelscope_studio': patch
---

feat: complete components params in Python
17 changes: 17 additions & 0 deletions .changeset/fuzzy-goats-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@modelscope-studio/legacy-waterfall-gallery': patch
'@modelscope-studio/legacy-multimodal-input': patch
'@modelscope-studio/legacy-lifecycle': patch
'@modelscope-studio/legacy-markdown': patch
'@modelscope-studio/legacy-compiled': patch
'@modelscope-studio/legacy-chatbot': patch
'@modelscope-studio/legacy-flow': patch
'@modelscope-studio/lint-config': patch
'@modelscope-studio/changelog': patch
'@modelscope-studio/antd': patch
'@modelscope-studio/base': patch
'@modelscope-studio/frontend': patch
'modelscope_studio': patch
---

feat: add new features
17 changes: 17 additions & 0 deletions .changeset/lemon-laws-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@modelscope-studio/legacy-waterfall-gallery': patch
'@modelscope-studio/legacy-multimodal-input': patch
'@modelscope-studio/legacy-lifecycle': patch
'@modelscope-studio/legacy-markdown': patch
'@modelscope-studio/legacy-compiled': patch
'@modelscope-studio/legacy-chatbot': patch
'@modelscope-studio/legacy-flow': patch
'@modelscope-studio/lint-config': patch
'@modelscope-studio/changelog': patch
'@modelscope-studio/antd': patch
'@modelscope-studio/base': patch
'@modelscope-studio/frontend': patch
'modelscope_studio': patch
---

feat: migrate to gradio 5
25 changes: 25 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"mode": "pre",
"tag": "beta",
"initialVersions": {
"modelscope_studio": "0.4.2",
"@modelscope-studio/changelog": "0.4.2",
"@modelscope-studio/lint-config": "0.4.2",
"@modelscope-studio/frontend": "0.4.2",
"@modelscope-studio/antd": "0.0.0",
"@modelscope-studio/base": "0.0.0",
"@modelscope-studio/legacy-chatbot": "0.4.2",
"@modelscope-studio/legacy-flow": "0.4.2",
"@modelscope-studio/legacy-lifecycle": "0.4.2",
"@modelscope-studio/legacy-markdown": "0.4.2",
"@modelscope-studio/legacy-multimodal-input": "0.4.2",
"@modelscope-studio/legacy-waterfall-gallery": "0.4.2",
"@modelscope-studio/legacy-compiled": "0.4.2"
},
"changesets": [
"five-actors-compete",
"fuzzy-goats-retire",
"lemon-laws-cross",
"tough-walls-grab"
]
}
17 changes: 17 additions & 0 deletions .changeset/tough-walls-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@modelscope-studio/legacy-waterfall-gallery': major
'@modelscope-studio/legacy-multimodal-input': major
'@modelscope-studio/legacy-lifecycle': major
'@modelscope-studio/legacy-markdown': major
'@modelscope-studio/legacy-compiled': major
'@modelscope-studio/legacy-chatbot': major
'@modelscope-studio/legacy-flow': major
'@modelscope-studio/lint-config': major
'@modelscope-studio/changelog': major
'@modelscope-studio/antd': major
'@modelscope-studio/base': major
'@modelscope-studio/frontend': major
'modelscope_studio': major
---

feat: integrate ant design
2 changes: 0 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,5 @@ jobs:
run: npm i pnpm@latest -g
- name: Install Node Dependencies
run: pnpm install
- name: Build Dependencies
run: pnpm run build:compiled
- name: Run Lint
run: pnpm run lint
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint -e $HUSKY_GIT_PARAMS
pnpm exec commitlint -e $HUSKY_GIT_PARAMS
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
pnpm exec lint-staged
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"*.{less,css}": ["pnpm run lint:style", "pnpm run format"],
"*.{js,jsx,ts,tsx}": ["pnpm run lint:js", "pnpm run format"],
"*.{js,jsx,ts,tsx,svelte}": ["pnpm run lint:js", "pnpm run format"],
"*.{md,yaml,yml,json,html}": ["pnpm run format"],
"*.py": ["pnpm run lint:py"]
}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# modelscope_studio

## 1.0.0-beta.3

### Features

- [`9f3c59c`](https://github.com/modelscope/modelscope-studio/commit/9f3c59c9c5a0bf8af3980588cb07a467323b1d17) - add new features. Thanks [@Col0ring](https://github.com/Col0ring)!

## 1.0.0-beta.2

### Features

- [`9e5da52`](https://github.com/modelscope/modelscope-studio/commit/9e5da52fc739c6862225192fecf95f6bfd7923ad) - complete components params in Python. Thanks [@Col0ring](https://github.com/Col0ring)!

## 1.0.0-beta.1

### Features

- [`025f728`](https://github.com/modelscope/modelscope-studio/commit/025f72825bdafbc60b4a09e577a363e43189bd1d) - migrate to gradio 5. Thanks [@Col0ring](https://github.com/Col0ring)!

## 1.0.0-beta.0

### Features

- [`4a46970`](https://github.com/modelscope/modelscope-studio/commit/4a46970007452af606abe02cdfa54a4959b2f3db) - integrate ant design. Thanks [@Col0ring](https://github.com/Col0ring)!

## 0.5.2

### Fixes
Expand Down
87 changes: 42 additions & 45 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<h1>ModelScope Studio</h1>
> 当前文档版本为 `1.0 beta`,如果您正在使用以前的`modelscope_studio`版本,请跳转至 [legacy](https://github.com/modelscope/modelscope-studio/tree/legacy) 分支查看。

# ModelScope Studio

<p align="center">
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" height="60" style="vertical-align: middle;"/>
Expand All @@ -9,66 +11,67 @@
<p>

<p align="center">
<a href="https://github.com/modelscope/modelscope-studio">GitHub</a> | 🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope-studio/summary">ModelScope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope-studio">Hugging Face Space</a>
<a href="https://github.com/modelscope/modelscope-studio">GitHub</a> | 🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope-studio-beta">ModelScope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope-studio-beta">Hugging Face Space</a>
<br>
中文&nbsp | &nbsp<a href="README.md">English</a>&nbsp | &nbsp<a href="README-ja_JP.md">日本語</a>
</p>

`modelscope_studio` 是一套基于 gradio 4.x 的扩展组件库,致力于服务于 ModelScope 创空间中对于 gradio 应用的各类扩展需求,目前主要聚集在对话场景增强、多模态场景以及一些其他垂直场景支持。
`modelscope_studio`是一个基于 Gradio 的三方组件库,在原有 Gradio 组件的基础上延伸了更多的组件和使用形式。

目前支持的 UI 库:

- [Ant Design](https://ant.design/)

## 何时使用

比起 Gradio 自身的组件,`modelscope_studio`更加注重页面布局和组件的灵活性,如果您想要构建更漂亮的用户界面,我们非常推荐您使用`modelscope_studio`。然而,当您的应用需要 Gradio 在 Python 端更多地处理内置数据时,`modelscope_studio`可能不是最好的选择,但仍然可以使用`modelscope_studio`的布局和展示组件来帮助您构建页面。

## 依赖

- Gradio >= 4.0

## 安装

```sh
pip install modelscope_studio
pip install modelscope_studio~=1.0.0b
```

## 快速开始

```python
import time
import gradio as gr
import modelscope_studio as mgr

def submit(_input, _chatbot):
print('text:', _input.text)
print('files: ', _input.files)
_chatbot.append([_input, None])
yield _chatbot
time.sleep(1)
_chatbot[-1][1] = [{
"flushing": False,
"text": 'bot1: ' + _input.text + '!'
}, {
"text": 'bot2: ' + _input.text + '!'
}]
yield {
chatbot: _chatbot,
}

with gr.Blocks() as demo:
chatbot = mgr.Chatbot(height=400)
import modelscope_studio.components.antd as antd
import modelscope_studio.components.base as ms

input = mgr.MultimodalInput()
input.submit(fn=submit, inputs=[input, chatbot], outputs=[chatbot])
with gr.Blocks() as demo:
with ms.Application():
with antd.ConfigProvider():
antd.DatePicker()

demo.queue().launch()
```

![quickstart](./resources/quickstart.png)
## 文档与示例

## 组件文档
- ModelScope: [中文](https://modelscope.cn/studios/modelscope/modelscope-studio-beta)
- Hugging Face: [English](<(https://huggingface.co/spaces/modelscope/modelscope-studio-beta)>)

目前已支持的组件包括:
## 迁移到 1.0

- Chatbot: gradio Chatbot 扩展组件,支持输出多模态内容、支持多 bot 场景、支持对话内容内的自定义渲染组件及事件交互。
- MultimodalInput: 多模态输入框,支持上传文件、录音、照相等功能。
- Markdown: gradio Markdown 扩展组件,支持输出多模态内容(音频、视频、语音、文件、文本)。
- Lifecycle: 生命周期组件,用于获取当前用户的环境信息。
- WaterfallGallery: gradio Gallery 扩展组件,支持瀑布流的图像展示。
- Flow: 基于 [reactflow](https://reactflow.dev/) 的 Flow 组件,支持通过 schema 定制节点渲染。
- 更多组件...
如果您在之前使用了`modelscope_studio`的组件,并且想要在新版本中继续使用。不需要对原有组件做任何修改,只需要在外层引入`ms.Application`即可。

详细使用参见 [文档与示例](https://modelscope.cn/studios/modelscope/modelscope-studio/summary)
```python
import gradio as gr
import modelscope_studio.components.base as ms
import modelscope_studio.components.legacy as mgr

with gr.Blocks() as demo:
with ms.Application():
mgr.Chatbot()

demo.launch()
```

## 开发

Expand All @@ -86,14 +89,8 @@ pnpm install
pnpm build
```

运行 Demo!

```sh
gradio docs/app.py
```

或者像下面这样运行单个 Demo:
运行 `gradio cc dev` 启动 demo:

```sh
gradio docs/components/Chatbot/demos/basic.py
gradio cc dev docs/app.py
```
Loading
Loading