import gradio as gr from app import demo as app import os _docs = {'WorkflowBuilder': {'description': 'Professional Workflow Builder component with support for 25+ node types\ninspired by n8n and Langflow for AI agent development and MCP integration.', 'members': {'__init__': {'value': {'type': 'typing.Optional[typing.Dict[str, typing.Any]][\n typing.Dict[str, typing.Any][str, typing.Any], None\n]', 'default': 'None', 'description': 'Default workflow data with nodes and edges'}, 'label': {'type': 'typing.Optional[str][str, None]', 'default': 'None', 'description': 'Component label'}, 'info': {'type': 'typing.Optional[str][str, None]', 'default': 'None', 'description': 'Additional component information'}, 'show_label': {'type': 'typing.Optional[bool][bool, None]', 'default': 'None', 'description': 'Whether to show the label'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'Whether to use container styling'}, 'scale': {'type': 'typing.Optional[int][int, None]', 'default': 'None', 'description': 'Relative width scale'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'Minimum width in pixels'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'Whether component is visible'}, 'elem_id': {'type': 'typing.Optional[str][str, None]', 'default': 'None', 'description': 'HTML element ID'}, 'elem_classes': {'type': 'typing.Optional[typing.List[str]][\n typing.List[str][str], None\n]', 'default': 'None', 'description': 'CSS classes'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'Whether to render immediately'}}, 'postprocess': {'value': {'type': 'typing.Dict[str, typing.Any][str, typing.Any]', 'description': None}}, 'preprocess': {'return': {'type': 'typing.Dict[str, typing.Any][str, typing.Any]', 'description': None}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the WorkflowBuilder changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the WorkflowBuilder.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'WorkflowBuilder': []}}} abs_path = os.path.join(os.path.dirname(__file__), "css.css") with gr.Blocks( css=abs_path, theme=gr.themes.Default( font_mono=[ gr.themes.GoogleFont("Inconsolata"), "monospace", ], ), ) as demo: workflow builder """, elem_classes=["md-custom"], header_links=True) app.render() gr.Markdown( """ ## Installation ```bash pip install gradio_workflowbuilder ``` ## Usage ```python import gradio as gr from gradio_workflowbuilder import WorkflowBuilder import json def export_workflow(workflow_data): \"\"\"Export workflow as formatted JSON\"\"\" if not workflow_data: return "No workflow to export" return json.dumps(workflow_data, indent=2) # Create the main interface with gr.Blocks( title="🎨 Visual Workflow Builder", theme=gr.themes.Soft(), css=\"\"\" .main-container { max-width: 1600px; margin: 0 auto; } .workflow-section { margin-bottom: 2rem; } .button-row { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; } .component-description { padding: 24px; background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); border-radius: 12px; border-left: 4px solid #3b82f6; margin: 16px 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); } .component-description p { margin: 10px 0; line-height: 1.6; color: #374151; } .base-description { font-size: 17px; font-weight: 600; color: #1e293b; } .base-description strong { color: #3b82f6; font-weight: 700; } .feature-description { font-size: 16px; color: #1e293b; font-weight: 500; } .customization-note { font-size: 15px; color: #64748b; font-style: italic; } .sample-intro { font-size: 15px; color: #1e293b; font-weight: 600; margin-top: 16px; border-top: 1px solid #e2e8f0; padding-top: 16px; } \"\"\" ) as demo: with gr.Column(elem_classes=["main-container"]): gr.Markdown(\"\"\" # 🎨 Visual Workflow Builder **Create sophisticated workflows with drag and drop simplicity.** \"\"\") # Simple description section with styling gr.HTML(\"\"\"
Base custom component powered by svelteflow.
Create custom workflows.
You can customise the nodes as well as the design of the workflow.
Here is a sample: