Skip to content

App Components

you can freely customize development and integration, flexibly adapt to your specific needs, and create personalized applications.

Application Preview

Plugin Development

1. Define

python
...
from src.app.prefs import INSTANCES as prefs
from src.gradio.tools import helper
from src.gradio.tools.toast import Toast

def gradio(**kwargs):

    # 配置
    cfg = prefs.get()

    # 界面
    with gr.Blocks(**kwargs) as app:

        with gr.Row():
            input_url = gr.Textbox(label=i18n("链接"), max_lines=1, placeholder=i18n("粘贴链接"))

        with gr.Row():
            title_txt = gr.Textbox(label=i18n("标题"), max_lines=1, interactive=False)

        with gr.Tabs() as tabs:
            with gr.TabItem(i18n("封面")):
                thumb_image = gr.Image(label=i18n("预览"), height=300)
            with gr.TabItem(i18n("视频")):
                video_table = gr.Dataframe(label=i18n("视频列表"), headers=[i18n("ID"), i18n("格式"), i18n("分辨率"), i18n("大小"), i18n("音频")], interactive=False, elem_id="output-table")
                video_fmt_input = gr.Textbox(label=i18n("ID"), max_lines=1, placeholder=i18n("请输入视频格式ID"))
                btn_v_download = gr.Button(i18n("下载"))
                video_file = gr.Video(label=i18n("预览"), height=300)
            with gr.TabItem(i18n("音频")):
                audio_table = gr.Dataframe(label=i18n("音频列表"), headers=[i18n("ID"), i18n("格式"), i18n("码率"), i18n("大小")], interactive=False, elem_id="output-table")
                audio_fmt_input = gr.Textbox(label=i18n("ID"), max_lines=1, placeholder=i18n("请输入音频格式ID"))
                btn_a_download = gr.Button(i18n("下载"))
                audio_file = gr.Audio(label=i18n("预览"), type="filepath")
            with gr.TabItem(i18n("字幕")):
                subs_table = gr.Dataframe(label=i18n("字幕列表"), headers=[i18n("语言"), i18n("格式"), i18n("URL")], interactive=False)
                sub_lang_input = gr.Textbox(label=i18n("语言"), max_lines=1, placeholder=i18n("请输入字幕语言代码"))
                sub_ext_input = gr.Textbox(label=i18n("格式"), max_lines=1, placeholder=i18n("请输入字幕格式"))
                btn_s_download = gr.Button(i18n("下载"))
                sub_file = gr.File(label=i18n("字幕文件"))

        with gr.Row():
            parse_btn = gr.Button(i18n("解析"), variant="primary")

        gr.Examples(
            label=i18n("示例"),
            examples=[
                ["bilibili", "https://www.bilibili.com/video/BV1BZ42187Qm"],
                ["youtube", "https://www.youtube.com/watch?v=SMWdVHNByhk"],
            ],
            inputs=[title_txt, input_url],
        )

        ...

    return app

if __name__ == "__main__":
    gradio().launch(server_port=8001)
python
import gradio as gr

# Theme
default_themes = [
    gr.themes.Base,
    gr.themes.Default,
    gr.themes.Soft,
    gr.themes.Monochrome,
    gr.themes.Glass,
    gr.themes.Origin,
    gr.themes.Citrus,
    gr.themes.Ocean,
]

###################### Theme Customization ######################
custom_theme = gr.themes.Ocean(
    text_size="sm",
)
###################### Theme Customization ######################

def _default_theme():
    return custom_theme

if __name__ == "__main__":
    # 1、run `python builder.py` to open the theme builder
    # 2、or see https://huggingface.co/spaces/gradio/theme_builder
    from gradio import themes as t
    t.builder()

2. Register

bash
curl -X 'POST' \
  'http://127.0.0.1:8000/plugin/upsert' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
        "id": 10001,                                        # ID
        "name": "dlp",                                      # Name
        "description": "YouTube Downloader Plus (yt-dlp)",  # Description
        "image": "../static/images/img_placeholder.png",    # Thumbnail
        "module": "src.gradio.component.dlp_",              # Path
        "attr": "gradio",                                   # Method
        "url": "/dlp",                                      # Request
        "type": 1,                                          # Type (1: Component, 2: Extension)
        "status": 1                                         # Status
    }'

3. Open

Thumbnail Video Audio
gradio_custom_dlp_image gradio_app_dlp gradio_custom_dlp_audio

Scenario Customization

1. Batch Processing

Batch Operations?

To be added

2. MCP

How to integrate third-party MCP workflows

To be added

Exclusive Plugin

Design, develop, and integrate specialized plugins based on CreatorBox to extend existing software functionality.

If you need custom plugin development, please leave a message at Plugin Development & Integration.