Spaces:
Running
Running
feat: add mgr.load
Browse files- README-zh_CN.md +4 -0
- README.md +4 -0
- api/app.py +19 -0
- api/load-zh_CN.md +30 -0
- api/load.md +30 -0
- app.py +2 -0
- components/Flow/README.md +12 -12
- modelscope_studio-0.2.1-py3-none-any.whl → modelscope_studio-0.3.0-py3-none-any.whl +2 -2
- requirements.txt +1 -1
README-zh_CN.md
CHANGED
@@ -19,6 +19,10 @@
|
|
19 |
pip install modelscope_studio
|
20 |
```
|
21 |
|
|
|
|
|
|
|
|
|
22 |
## Components
|
23 |
|
24 |
- <tab-link component-tab="Chatbot">Chatbot</tab-link>
|
|
|
19 |
pip install modelscope_studio
|
20 |
```
|
21 |
|
22 |
+
## API
|
23 |
+
|
24 |
+
- <tab-link component-tab="API">load</tab-link>
|
25 |
+
|
26 |
## Components
|
27 |
|
28 |
- <tab-link component-tab="Chatbot">Chatbot</tab-link>
|
README.md
CHANGED
@@ -35,6 +35,10 @@ license: apache-2.0
|
|
35 |
pip install modelscope_studio
|
36 |
```
|
37 |
|
|
|
|
|
|
|
|
|
38 |
## Components
|
39 |
|
40 |
- <tab-link component-tab="Chatbot">Chatbot</tab-link>
|
|
|
35 |
pip install modelscope_studio
|
36 |
```
|
37 |
|
38 |
+
## API
|
39 |
+
|
40 |
+
- <tab-link component-tab="API">load</tab-link>
|
41 |
+
|
42 |
## Components
|
43 |
|
44 |
- <tab-link component-tab="Chatbot">Chatbot</tab-link>
|
api/app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
from components.Docs import Docs
|
4 |
+
|
5 |
+
|
6 |
+
def resolve(relative_path: str):
|
7 |
+
return os.path.join(os.path.dirname(__file__), relative_path)
|
8 |
+
|
9 |
+
|
10 |
+
docs = Docs(
|
11 |
+
__file__,
|
12 |
+
markdown_files=([
|
13 |
+
filename for filename in os.listdir(resolve('.'))
|
14 |
+
if filename.endswith(".md")
|
15 |
+
]),
|
16 |
+
)
|
17 |
+
|
18 |
+
if __name__ == "__main__":
|
19 |
+
docs.render().queue().launch()
|
api/load-zh_CN.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# load
|
2 |
+
|
3 |
+
该特性与 [gr.load](https://www.gradio.app/docs/gradio/load) 类似。允许用户从已有创空间 [ModelScope Studio](https://modelscope.cn/studios) 仓库构造 demo。
|
4 |
+
|
5 |
+
## 如何使用
|
6 |
+
|
7 |
+
### 基本使用
|
8 |
+
|
9 |
+
```python
|
10 |
+
import modelscope_studio as mgr
|
11 |
+
demo = mgr.load("modelscope/modelscope-studio")
|
12 |
+
demo.launch()
|
13 |
+
```
|
14 |
+
|
15 |
+
### 使用访问令牌
|
16 |
+
|
17 |
+
使用访问令牌来加载私有创空间。在这里找到您的 sdk 令牌:https://modelscope.cn/my/myaccesstoken。
|
18 |
+
|
19 |
+
```python
|
20 |
+
import modelscope_studio as mgr
|
21 |
+
demo = mgr.load("modelscope/modelscope-studio", token="YOUR_ACCESS_TOKEN")
|
22 |
+
demo.launch()
|
23 |
+
```
|
24 |
+
|
25 |
+
## 初始化
|
26 |
+
|
27 |
+
| 属性 | 类型 | 默认值 | 描述 |
|
28 |
+
| ----- | ---- | ------ | ---------------------------------------------------------------------------------------------------- |
|
29 |
+
| name | str | None | 必填。 创空间名称(如: "modelscope/modelscope-studio")。 |
|
30 |
+
| token | str | None | 用于加载私有创空间的可选访问令牌。 在这里找到您的 sdk 令牌:https://modelscope.cn/my/myaccesstoken。 |
|
api/load.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# load
|
2 |
+
|
3 |
+
This feature is similar to [gr.load](https://www.gradio.app/docs/gradio/load). Allow users to Construct a demo from a [ModelScope Studio](https://modelscope.cn/studios) repo.
|
4 |
+
|
5 |
+
## How to Use
|
6 |
+
|
7 |
+
### Basic Usage
|
8 |
+
|
9 |
+
```python
|
10 |
+
import modelscope_studio as mgr
|
11 |
+
demo = mgr.load("modelscope/modelscope-studio")
|
12 |
+
demo.launch()
|
13 |
+
```
|
14 |
+
|
15 |
+
### With Access Token
|
16 |
+
|
17 |
+
Use the access token to load a private ModelScope Studio repo. Find your sdk token here: https://modelscope.cn/my/myaccesstoken.
|
18 |
+
|
19 |
+
```python
|
20 |
+
import modelscope_studio as mgr
|
21 |
+
demo = mgr.load("modelscope/modelscope-studio", token="YOUR_ACCESS_TOKEN")
|
22 |
+
demo.launch()
|
23 |
+
```
|
24 |
+
|
25 |
+
## Initialization
|
26 |
+
|
27 |
+
| Parameter | Type | Default Value | Description |
|
28 |
+
| --------- | ---- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
29 |
+
| name | str | None | required. the name of the ModelScope Studio repo (e.g. "modelscope/modelscope-studio"). |
|
30 |
+
| token | str | None | optional access token for loading private ModelScope Studio repo. Find your sdk token here: https://modelscope.cn/my/myaccesstoken. |
|
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from components.Chatbot.app import docs as chatbot_docs
|
3 |
from components.Docs import Docs
|
4 |
from components.Flow.app import docs as flow_docs
|
@@ -10,6 +11,7 @@ readme_docs = Docs(__file__)
|
|
10 |
|
11 |
docs = [
|
12 |
["Quick Start", readme_docs],
|
|
|
13 |
["Chatbot", chatbot_docs],
|
14 |
["Markdown", markdown_docs],
|
15 |
["MultimodalInput", multimodel_input_docs],
|
|
|
1 |
import gradio as gr
|
2 |
+
from api.app import docs as api_docs
|
3 |
from components.Chatbot.app import docs as chatbot_docs
|
4 |
from components.Docs import Docs
|
5 |
from components.Flow.app import docs as flow_docs
|
|
|
11 |
|
12 |
docs = [
|
13 |
["Quick Start", readme_docs],
|
14 |
+
["API", api_docs],
|
15 |
["Chatbot", chatbot_docs],
|
16 |
["Markdown", markdown_docs],
|
17 |
["MultimodalInput", multimodel_input_docs],
|
components/Flow/README.md
CHANGED
@@ -62,18 +62,18 @@ class FlowData(GradioModel):
|
|
62 |
|
63 |
### props
|
64 |
|
65 |
-
|
|
66 |
-
| ------------------- | --------------------------------------------------------------------- |
|
67 |
-
| height | int \| str | 600
|
68 |
-
| sync_on_data_change | bool | None
|
69 |
-
| schema | FlowSchemaDict \| dict | None
|
70 |
-
| show_sidebar | bool | True
|
71 |
-
| show_minimap | bool | True
|
72 |
-
| show_controls | bool | True
|
73 |
-
| background_props | BackgroundPropsDict \| dict BackgroundPropsDict definition below | None
|
74 |
-
| min_zoom | int | 0.1
|
75 |
-
| max_zoom | int | 2
|
76 |
-
| custom_components | dict\[str, CustomComponentDict\] CustomComponentDict definition below | None
|
77 |
|
78 |
**BackgroundPropsDict definition:**
|
79 |
|
|
|
62 |
|
63 |
### props
|
64 |
|
65 |
+
| Attribute | Type | Default Value | Description |
|
66 |
+
| ------------------- | --------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
67 |
+
| height | int \| str | 600 | Height of the Flow component. |
|
68 |
+
| sync_on_data_change | bool | None | Whether to sync the Python value only on data change (e.g., node attributes, node count, edge count, connection ports, not including node positions). If you want better page performance without full data sync, set this to True. |
|
69 |
+
| schema | FlowSchemaDict \| dict | None | Defines the nodes and edges of the Flow component. |
|
70 |
+
| show_sidebar | bool | True | Whether to display the sidebar in the Flow component. |
|
71 |
+
| show_minimap | bool | True | Whether to display the minimap in the Flow component. |
|
72 |
+
| show_controls | bool | True | Whether to display the controls bar in the Flow component. |
|
73 |
+
| background_props | BackgroundPropsDict \| dict BackgroundPropsDict definition below | None | Modify the background of the Flow component, see the BackgroundPropsDict type. |
|
74 |
+
| min_zoom | int | 0.1 | Minimum zoom level for the Flow component. |
|
75 |
+
| max_zoom | int | 2 | Maximum zoom level for the Flow component. |
|
76 |
+
| custom_components | dict\[str, CustomComponentDict\] CustomComponentDict definition below | None | Supports user-defined custom tags and controls tag rendering styles and triggers Python events through js. |
|
77 |
|
78 |
**BackgroundPropsDict definition:**
|
79 |
|
modelscope_studio-0.2.1-py3-none-any.whl → modelscope_studio-0.3.0-py3-none-any.whl
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b64a48534196fea70a43e9b1cebf7dc881ae8138d10a3e520fa59b5477480967
|
3 |
+
size 10950399
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
modelscope_studio
|
2 |
-
modelscope_studio-0.
|
|
|
1 |
modelscope_studio
|
2 |
+
modelscope_studio-0.3.0-py3-none-any.whl
|