Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Col0ring committed Nov 11, 2024
1 parent 4c07851 commit bd4bbbc
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 64 deletions.
22 changes: 19 additions & 3 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> 当前文档版本为 `1.0 beta`,如果您正在使用以前的`modelscope_studio`版本,请跳转至 [legacy](https://github.com/modelscope/modelscope-studio/tree/legacy) 分支查看。
# ModelScope Studio

<p align="center">
Expand All @@ -9,11 +11,25 @@
<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 的三方组件库,在原有 Gradio 组件的基础上延伸了更多的组件和使用形式。

目前支持的 UI 库:

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

## 何时使用

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

## 依赖

- Gradio >= 4.0

## 安装

```sh
Expand All @@ -38,8 +54,8 @@ demo.queue().launch()

## 文档与示例

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

## 迁移到 1.0

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> The current document version is `1.0 beta`. If you are using a previous version of `modelscope_studio`, please switch to the [legacy](https://github.com/modelscope/modelscope-studio/tree/legacy) branch for reference.
# ModelScope Studio

<p align="center">
Expand All @@ -9,7 +11,7 @@
<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>
<a href="README-zh_CN.md">中文</a>&nbsp | &nbspEnglish&nbsp | &nbsp<a href="README-ja_JP.md">日本語</a>
</p>
Expand Down Expand Up @@ -54,8 +56,8 @@ demo.queue().launch()

## Documentation and Examples

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

## Migration to 1.0

Expand Down
15 changes: 0 additions & 15 deletions docs/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<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>

`modelscope_studio`是一个基于 Gradio 的三方组件库,在原有 Gradio 组件的基础上延伸了更多的组件和使用形式。

Expand Down
19 changes: 18 additions & 1 deletion docs/components/base/overview/README.md → docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
---
tags:
- gradio-custom-component
- component library
- Ant Design
- modelscope-studio
title: modelscope-studio
colorFrom: blue
colorTo: gray
short_description: A third-party component library based on Gradio.
sdk: gradio
pinned: false
header: mini
app_file: app.py
license: apache-2.0
---

# ModelScope Studio

<p align="center">
Expand All @@ -9,7 +26,7 @@
<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>

`modelscope_studio` is a third-party component library based on Gradio, extending more components and usage forms on top of the original Gradio components.

Expand Down
26 changes: 19 additions & 7 deletions docs/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from typing import Literal

from helper.Docs import Docs
from helper.env import is_modelscope_studio
from helper.Site import Site
from legacy_app import legacy_demo
Expand Down Expand Up @@ -34,19 +35,23 @@ def get_docs(file_path: str, type: Literal["antd", "base"]):
"doc", os.path.join(components_dir, component, "app.py"))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
docs[component] = module
docs[component] = module.docs
return docs


index_docs = {"modelscope_studio": Docs(__file__)}

base_docs = get_docs(__file__, "base")
antd_docs = get_docs(__file__, "antd")

default_active_tab = "base"
default_active_tab = "index"

index_menu_items = [{
"label": get_text("ModelScope-Studio", "ModelScope-Studio"),
"key": "modelscope_studio"
}]

base_menu_items = [{
"label": get_text("Overview", "概览"),
"key": "overview"
}, {
"label":
get_text("Core", "核心"),
"type":
Expand Down Expand Up @@ -147,10 +152,16 @@ def more_components():


tabs = [
{
"label": get_text("Overview", "预览"),
"key": "index",
"default_active_key": "modelscope_studio",
"menus": index_menu_items
},
{
"label": get_text("Base Components", "基础组件"),
"key": "base",
"default_active_key": "overview",
"default_active_key": "application",
"menus": base_menu_items
},
{
Expand All @@ -171,6 +182,7 @@ def more_components():
tabs=tabs,
docs={
# match the key of tabs
"index": index_docs,
"antd": antd_docs,
"base": base_docs
},
Expand All @@ -180,4 +192,4 @@ def more_components():
demo = site.render()

if __name__ == "__main__":
demo.launch()
demo.queue().launch(ssr_mode=False)
6 changes: 0 additions & 6 deletions docs/components/base/overview/app.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/components/legacy/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<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">ModelScope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope-studio">Hugging Face Space</a>

`modelscope_studio` 是一套基于 gradio 4.x 的扩展组件库,致力于服务于 ModelScope 创空间中对于 gradio 应用的各类扩展需求,目前主要聚集在对话场景增强、多模态场景以及一些其他垂直场景支持。

Expand Down
18 changes: 1 addition & 17 deletions docs/components/legacy/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
---
tags:
- gradio-custom-component
- Chatbot
- MutilmodalInput
- Markdown
- gradio-template-Chatbot
- gradio-template-Markdown
title: modelscope-studio
colorFrom: blue
colorTo: gray
sdk: docker
pinned: false
license: apache-2.0
---

<h1>ModelScope Studio</h1>

<p align="center">
Expand All @@ -25,7 +9,7 @@ license: apache-2.0
<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">ModelScope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope-studio">Hugging Face Space</a>

`modelscope_studio` is a set of extension component libraries based on gradio 4.x, dedicated to serving the various extension needs of gradio applications within the ModelScope Studio. It mainly focuses on enhancing conversational scenarios, supporting multimodal contexts, and providing assistance for various other specialized scenarios.

Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions docs/helper/Site.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _render_docs(self, items: list, tab: dict):
visible=True if tab.get("default_active_key")
== key else False) as docs_tab:
docs_tabs.append(docs_tab)
tab_docs[key].docs.render()
tab_docs[key].render()
return docs_tabs

def render(self):
Expand Down Expand Up @@ -183,14 +183,14 @@ def on_layout_menu_select(

return on_layout_menu_select

sider_menu.select(
fn=on_layout_menu_select_wrapper(
docs_tabs, sider_menu,
layout_content_tabs),
outputs=[
sider_menu, layout_content_tabs,
*docs_tabs
])
sider_menu.select(
fn=on_layout_menu_select_wrapper(
docs_tabs, sider_menu,
layout_content_tabs),
outputs=[
sider_menu, layout_content_tabs,
*docs_tabs
])
tab_menu.select(
fn=on_tab_menu_select,
outputs=[tab_menu, tabs, *tab_components])
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
modelscope_studio
modelscope_studio-0.4.0-py3-none-any.whl
modelscope_studio-1.0.0b3-py3-none-any.whl

0 comments on commit bd4bbbc

Please sign in to comment.