import{s as Fl,o as Xl,n as _l}from"../chunks/scheduler.53228c21.js";import{S as Nl,i as Yl,e as C,s as y,c as U,h as vl,a as c,d as s,b as I,f as Sl,g as e,j as b,k as ul,l as Hl,m as J,n as p,t as o,o as A,p as i}from"../chunks/index.100fac89.js";import{C as zl}from"../chunks/CopyLLMTxtMenu.20a72e0e.js";import{C as d}from"../chunks/CodeBlock.d30a6509.js";import{H as P,E as ql}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4d82655d.js";import{H as $l,a as Vl}from"../chunks/HfOption.fad27e59.js";function xl(h){let T,j,a,r="Then upload the block to the Hub:",w,n,m;return T=new d({props:{code:"JTIzJTIwSW4lMjB0aGUlMjBmb2xkZXIlMjB3aXRoJTIwdGhlJTIwJTYwYmxvY2sucHklNjAlMjBmaWxlJTJDJTIwcnVuJTNBJTBBZGlmZnVzZXJzLWNsaSUyMGN1c3RvbV9ibG9jaw==",highlighted:'<span class="hljs-meta prompt_"># </span><span class="language-bash">In the folder with the `block.py` file, run:</span>\ndiffusers-cli custom_block',wrap:!1}}),n=new d({props:{code:"aGYlMjB1cGxvYWQlMjAlM0N5b3VyJTIwcmVwbyUyMGlkJTNFJTIwLiUyMC4=",highlighted:"hf upload &lt;your repo id&gt; . .",wrap:!1}}),{c(){U(T.$$.fragment),j=y(),a=C("p"),a.textContent=r,w=y(),U(n.$$.fragment)},l(t){e(T.$$.fragment,t),j=I(t),a=c(t,"P",{"data-svelte-h":!0}),b(a)!=="svelte-itpmab"&&(a.textContent=r),w=I(t),e(n.$$.fragment,t)},m(t,u){p(T,t,u),J(t,j,u),J(t,a,u),J(t,w,u),p(n,t,u),m=!0},p:_l,i(t){m||(o(T.$$.fragment,t),o(n.$$.fragment,t),m=!0)},o(t){A(T.$$.fragment,t),A(n.$$.fragment,t),m=!1},d(t){t&&(s(j),s(a),s(w)),i(T,t),i(n,t)}}}function Dl(h){let T,j;return T=new d({props:{code:"ZnJvbSUyMGJsb2NrJTIwaW1wb3J0JTIwRmxvcmVuY2UySW1hZ2VBbm5vdGF0b3JCbG9jayUwQWJsb2NrJTIwJTNEJTIwRmxvcmVuY2UySW1hZ2VBbm5vdGF0b3JCbG9jaygpJTBBYmxvY2sucHVzaF90b19odWIoJTIyJTNDeW91ciUyMHJlcG8lMjBpZCUzRSUyMik=",highlighted:`<span class="hljs-keyword">from</span> block <span class="hljs-keyword">import</span> Florence2ImageAnnotatorBlock
block = Florence2ImageAnnotatorBlock()
block.push_to_hub(<span class="hljs-string">&quot;&lt;your repo id&gt;&quot;</span>)`,wrap:!1}}),{c(){U(T.$$.fragment)},l(a){e(T.$$.fragment,a)},m(a,r){p(T,a,r),j=!0},p:_l,i(a){j||(o(T.$$.fragment,a),j=!0)},o(a){A(T.$$.fragment,a),j=!1},d(a){i(T,a)}}}function Pl(h){let T,j,a,r;return T=new Vl({props:{id:"share",option:"hf CLI",$$slots:{default:[xl]},$$scope:{ctx:h}}}),a=new Vl({props:{id:"share",option:"push_to_hub",$$slots:{default:[Dl]},$$scope:{ctx:h}}}),{c(){U(T.$$.fragment),j=y(),U(a.$$.fragment)},l(w){e(T.$$.fragment,w),j=I(w),e(a.$$.fragment,w)},m(w,n){p(T,w,n),J(w,j,n),p(a,w,n),r=!0},p(w,n){const m={};n&2&&(m.$$scope={dirty:n,ctx:w}),T.$set(m);const t={};n&2&&(t.$$scope={dirty:n,ctx:w}),a.$set(t)},i(w){r||(o(T.$$.fragment,w),o(a.$$.fragment,w),r=!0)},o(w){A(T.$$.fragment,w),A(a.$$.fragment,w),r=!1},d(w){w&&s(j),i(T,w),i(a,w)}}}function Ll(h){let T,j,a,r,w,n,m,t,u,bl='<a href="./pipeline_block">ModularPipelineBlocks</a> are the fundamental building blocks of a <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline">ModularPipeline</a>. You can create custom blocks by defining their inputs, outputs, and computation logic. This guide demonstrates how to create and use a custom block.',L,B,dl='<p>Explore the <a href="https://huggingface.co/collections/diffusers/modular-diffusers-custom-blocks" rel="nofollow">Modular Diffusers Custom Blocks</a> collection for official custom modular blocks like Nano Banana.</p>',O,W,K,Z,hl="Your custom block project should use the following structure:",ll,k,Ml,R,Bl="<li><code>block.py</code> contains the custom block implementation</li> <li><code>modular_config.json</code> contains the metadata needed to load the block</li>",sl,f,Jl,g,Gl='In this example we will create a custom block that uses the <a href="https://huggingface.co/docs/transformers/model_doc/florence2" rel="nofollow">Florence 2</a> model to process an input image and generate a mask for inpainting.',Tl,E,Wl="The first step is to define the components that the block will use. In this case, we will need to use the <code>Florence2ForConditionalGeneration</code> model and its corresponding processor <code>AutoProcessor</code>. When defining components, we must specify the name of the component within our pipeline, model class via <code>type_hint</code>, and provide a <code>pretrained_model_name_or_path</code> for the component if we intend to load the model weights from a specific repository on the Hub.",wl,Q,al,S,Zl="Next, we define the inputs and outputs of the block. The inputs include the image to be annotated, the annotation task, and the annotation prompt. The outputs include the generated mask image and annotations.",yl,V,Il,_,kl="Now we implement the <code>__call__</code> method, which contains the logic for processing the input image and generating the mask.",tl,F,nl,X,Rl="Once we have defined our custom block, we can save it to the Hub, using either the CLI or the <code>push_to_hub</code> method. This will make it easy to share and reuse our custom block with other pipelines.",jl,G,Ul,N,el,Y,fl="Load the custom block with <code>from_pretrained()</code> and set <code>trust_remote_code=True</code>.",pl,v,ol,H,Al,z,gl="By default, custom blocks are saved in your cache directory. Use the <code>local_dir</code> argument to download and edit a custom block in a specific folder.",il,q,Cl,$,El="Any changes made to the block files in this folder will be reflected when you load the block again.",cl,x,ml,D,rl;return w=new zl({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),m=new P({props:{title:"Building Custom Blocks",local:"building-custom-blocks",headingTag:"h1"}}),W=new P({props:{title:"Project Structure",local:"project-structure",headingTag:"h2"}}),k=new d({props:{code:"LiUwQSVFMiU5NCU5QyVFMiU5NCU4MCVFMiU5NCU4MCUyMGJsb2NrLnB5JTBBJUUyJTk0JTk0JUUyJTk0JTgwJUUyJTk0JTgwJTIwbW9kdWxhcl9jb25maWcuanNvbg==",highlighted:`.
├── block.py
└── modular_config.json`,wrap:!1}}),f=new P({props:{title:"Example: Florence 2 Inpainting Block",local:"example-florence-2-inpainting-block",headingTag:"h2"}}),Q=new d({props:{code:"JTIzJTIwSW5zaWRlJTIwYmxvY2sucHklMEFmcm9tJTIwZGlmZnVzZXJzLm1vZHVsYXJfcGlwZWxpbmVzJTIwaW1wb3J0JTIwKCUwQSUyMCUyMCUyMCUyME1vZHVsYXJQaXBlbGluZUJsb2NrcyUyQyUwQSUyMCUyMCUyMCUyMENvbXBvbmVudFNwZWMlMkMlMEEpJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBGbG9yZW5jZTJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEElMEFjbGFzcyUyMEZsb3JlbmNlMkltYWdlQW5ub3RhdG9yQmxvY2soTW9kdWxhclBpcGVsaW5lQmxvY2tzKSUzQSUwQSUwQSUyMCUyMCUyMCUyMCU0MHByb3BlcnR5JTBBJTIwJTIwJTIwJTIwZGVmJTIwZXhwZWN0ZWRfY29tcG9uZW50cyhzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMENvbXBvbmVudFNwZWMoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbmFtZSUzRCUyMmltYWdlX2Fubm90YXRvciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHR5cGVfaGludCUzREZsb3JlbmNlMkZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTIyZmxvcmVuY2UtY29tbXVuaXR5JTJGRmxvcmVuY2UtMi1iYXNlLWZ0JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMENvbXBvbmVudFNwZWMoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbmFtZSUzRCUyMmltYWdlX2Fubm90YXRvcl9wcm9jZXNzb3IlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0eXBlX2hpbnQlM0RBdXRvUHJvY2Vzc29yJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjJmbG9yZW5jZS1jb21tdW5pdHklMkZGbG9yZW5jZS0yLWJhc2UtZnQlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjApJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVE",highlighted:`<span class="hljs-comment"># Inside block.py</span>
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> (
    ModularPipelineBlocks,
    ComponentSpec,
)
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Florence2ForConditionalGeneration


<span class="hljs-keyword">class</span> <span class="hljs-title class_">Florence2ImageAnnotatorBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">expected_components</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [
            ComponentSpec(
                name=<span class="hljs-string">&quot;image_annotator&quot;</span>,
                type_hint=Florence2ForConditionalGeneration,
                pretrained_model_name_or_path=<span class="hljs-string">&quot;florence-community/Florence-2-base-ft&quot;</span>,
            ),
            ComponentSpec(
                name=<span class="hljs-string">&quot;image_annotator_processor&quot;</span>,
                type_hint=AutoProcessor,
                pretrained_model_name_or_path=<span class="hljs-string">&quot;florence-community/Florence-2-base-ft&quot;</span>,
            ),
        ]`,wrap:!1}}),V=new d({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> <span class="hljs-type">List</span>, <span class="hljs-type">Union</span>
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image, ImageDraw
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> (
    PipelineState,
    ModularPipelineBlocks,
    InputParam,
    ComponentSpec,
    OutputParam,
)
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Florence2ForConditionalGeneration


<span class="hljs-keyword">class</span> <span class="hljs-title class_">Florence2ImageAnnotatorBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">expected_components</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [
            ComponentSpec(
                name=<span class="hljs-string">&quot;image_annotator&quot;</span>,
                type_hint=Florence2ForConditionalGeneration,
                pretrained_model_name_or_path=<span class="hljs-string">&quot;florence-community/Florence-2-base-ft&quot;</span>,
            ),
            ComponentSpec(
                name=<span class="hljs-string">&quot;image_annotator_processor&quot;</span>,
                type_hint=AutoProcessor,
                pretrained_model_name_or_path=<span class="hljs-string">&quot;florence-community/Florence-2-base-ft&quot;</span>,
            ),
        ]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>) -&gt; <span class="hljs-type">List</span>[InputParam]:
        <span class="hljs-keyword">return</span> [
            InputParam(
                <span class="hljs-string">&quot;image&quot;</span>,
                type_hint=<span class="hljs-type">Union</span>[Image.Image, <span class="hljs-type">List</span>[Image.Image]],
                required=<span class="hljs-literal">True</span>,
                description=<span class="hljs-string">&quot;Image(s) to annotate&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_task&quot;</span>,
                type_hint=<span class="hljs-type">Union</span>[<span class="hljs-built_in">str</span>, <span class="hljs-type">List</span>[<span class="hljs-built_in">str</span>]],
                required=<span class="hljs-literal">True</span>,
                default=<span class="hljs-string">&quot;&lt;REFERRING_EXPRESSION_SEGMENTATION&gt;&quot;</span>,
                description=<span class="hljs-string">&quot;&quot;&quot;Annotation Task to perform on the image.
                Supported Tasks:

                &lt;OD&gt;
                &lt;REFERRING_EXPRESSION_SEGMENTATION&gt;
                &lt;CAPTION&gt;
                &lt;DETAILED_CAPTION&gt;
                &lt;MORE_DETAILED_CAPTION&gt;
                &lt;DENSE_REGION_CAPTION&gt;
                &lt;CAPTION_TO_PHRASE_GROUNDING&gt;
                &lt;OPEN_VOCABULARY_DETECTION&gt;

                &quot;&quot;&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_prompt&quot;</span>,
                type_hint=<span class="hljs-type">Union</span>[<span class="hljs-built_in">str</span>, <span class="hljs-type">List</span>[<span class="hljs-built_in">str</span>]],
                required=<span class="hljs-literal">True</span>,
                description=<span class="hljs-string">&quot;&quot;&quot;Annotation Prompt to provide more context to the task.
                Can be used to detect or segment out specific elements in the image
                &quot;&quot;&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_output_type&quot;</span>,
                type_hint=<span class="hljs-built_in">str</span>,
                required=<span class="hljs-literal">True</span>,
                default=<span class="hljs-string">&quot;mask_image&quot;</span>,
                description=<span class="hljs-string">&quot;&quot;&quot;Output type from annotation predictions. Availabe options are
                mask_image:
                    -black and white mask image for the given image based on the task type
                mask_overlay:
                    - mask overlayed on the original image
                bounding_box:
                    - bounding boxes drawn on the original image
                &quot;&quot;&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_overlay&quot;</span>,
                type_hint=<span class="hljs-built_in">bool</span>,
                required=<span class="hljs-literal">True</span>,
                default=<span class="hljs-literal">False</span>,
                description=<span class="hljs-string">&quot;&quot;</span>,
            ),
        ]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>) -&gt; <span class="hljs-type">List</span>[OutputParam]:
        <span class="hljs-keyword">return</span> [
            OutputParam(
                <span class="hljs-string">&quot;mask_image&quot;</span>,
                type_hint=Image,
                description=<span class="hljs-string">&quot;Inpainting Mask for input Image(s)&quot;</span>,
            ),
            OutputParam(
                <span class="hljs-string">&quot;annotations&quot;</span>,
                type_hint=<span class="hljs-built_in">dict</span>,
                description=<span class="hljs-string">&quot;Annotations Predictions for input Image(s)&quot;</span>,
            ),
            OutputParam(
                <span class="hljs-string">&quot;image&quot;</span>,
                type_hint=Image,
                description=<span class="hljs-string">&quot;Annotated input Image(s)&quot;</span>,
            ),
        ]
`,wrap:!1}}),F=new d({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> <span class="hljs-type">List</span>, <span class="hljs-type">Union</span>
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image, ImageDraw
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> (
    PipelineState,
    ModularPipelineBlocks,
    InputParam,
    ComponentSpec,
    OutputParam,
)
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Florence2ForConditionalGeneration


<span class="hljs-keyword">class</span> <span class="hljs-title class_">Florence2ImageAnnotatorBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">expected_components</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [
            ComponentSpec(
                name=<span class="hljs-string">&quot;image_annotator&quot;</span>,
                type_hint=Florence2ForConditionalGeneration,
                pretrained_model_name_or_path=<span class="hljs-string">&quot;florence-community/Florence-2-base-ft&quot;</span>,
            ),
            ComponentSpec(
                name=<span class="hljs-string">&quot;image_annotator_processor&quot;</span>,
                type_hint=AutoProcessor,
                pretrained_model_name_or_path=<span class="hljs-string">&quot;florence-community/Florence-2-base-ft&quot;</span>,
            ),
        ]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>) -&gt; <span class="hljs-type">List</span>[InputParam]:
        <span class="hljs-keyword">return</span> [
            InputParam(
                <span class="hljs-string">&quot;image&quot;</span>,
                type_hint=<span class="hljs-type">Union</span>[Image.Image, <span class="hljs-type">List</span>[Image.Image]],
                required=<span class="hljs-literal">True</span>,
                description=<span class="hljs-string">&quot;Image(s) to annotate&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_task&quot;</span>,
                type_hint=<span class="hljs-type">Union</span>[<span class="hljs-built_in">str</span>, <span class="hljs-type">List</span>[<span class="hljs-built_in">str</span>]],
                required=<span class="hljs-literal">True</span>,
                default=<span class="hljs-string">&quot;&lt;REFERRING_EXPRESSION_SEGMENTATION&gt;&quot;</span>,
                description=<span class="hljs-string">&quot;&quot;&quot;Annotation Task to perform on the image.
                Supported Tasks:

                &lt;OD&gt;
                &lt;REFERRING_EXPRESSION_SEGMENTATION&gt;
                &lt;CAPTION&gt;
                &lt;DETAILED_CAPTION&gt;
                &lt;MORE_DETAILED_CAPTION&gt;
                &lt;DENSE_REGION_CAPTION&gt;
                &lt;CAPTION_TO_PHRASE_GROUNDING&gt;
                &lt;OPEN_VOCABULARY_DETECTION&gt;

                &quot;&quot;&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_prompt&quot;</span>,
                type_hint=<span class="hljs-type">Union</span>[<span class="hljs-built_in">str</span>, <span class="hljs-type">List</span>[<span class="hljs-built_in">str</span>]],
                required=<span class="hljs-literal">True</span>,
                description=<span class="hljs-string">&quot;&quot;&quot;Annotation Prompt to provide more context to the task.
                Can be used to detect or segment out specific elements in the image
                &quot;&quot;&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_output_type&quot;</span>,
                type_hint=<span class="hljs-built_in">str</span>,
                required=<span class="hljs-literal">True</span>,
                default=<span class="hljs-string">&quot;mask_image&quot;</span>,
                description=<span class="hljs-string">&quot;&quot;&quot;Output type from annotation predictions. Availabe options are
                mask_image:
                    -black and white mask image for the given image based on the task type
                mask_overlay:
                    - mask overlayed on the original image
                bounding_box:
                    - bounding boxes drawn on the original image
                &quot;&quot;&quot;</span>,
            ),
            InputParam(
                <span class="hljs-string">&quot;annotation_overlay&quot;</span>,
                type_hint=<span class="hljs-built_in">bool</span>,
                required=<span class="hljs-literal">True</span>,
                default=<span class="hljs-literal">False</span>,
                description=<span class="hljs-string">&quot;&quot;</span>,
            ),
        ]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>) -&gt; <span class="hljs-type">List</span>[OutputParam]:
        <span class="hljs-keyword">return</span> [
            OutputParam(
                <span class="hljs-string">&quot;mask_image&quot;</span>,
                type_hint=Image,
                description=<span class="hljs-string">&quot;Inpainting Mask for input Image(s)&quot;</span>,
            ),
            OutputParam(
                <span class="hljs-string">&quot;annotations&quot;</span>,
                type_hint=<span class="hljs-built_in">dict</span>,
                description=<span class="hljs-string">&quot;Annotations Predictions for input Image(s)&quot;</span>,
            ),
            OutputParam(
                <span class="hljs-string">&quot;image&quot;</span>,
                type_hint=Image,
                description=<span class="hljs-string">&quot;Annotated input Image(s)&quot;</span>,
            ),
        ]

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">get_annotations</span>(<span class="hljs-params">self, components, images, prompts, task</span>):
        task_prompts = [task + prompt <span class="hljs-keyword">for</span> prompt <span class="hljs-keyword">in</span> prompts]

        inputs = components.image_annotator_processor(
            text=task_prompts, images=images, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
        ).to(components.image_annotator.device, components.image_annotator.dtype)

        generated_ids = components.image_annotator.generate(
            input_ids=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>],
            pixel_values=inputs[<span class="hljs-string">&quot;pixel_values&quot;</span>],
            max_new_tokens=<span class="hljs-number">1024</span>,
            early_stopping=<span class="hljs-literal">False</span>,
            do_sample=<span class="hljs-literal">False</span>,
            num_beams=<span class="hljs-number">3</span>,
        )
        annotations = components.image_annotator_processor.batch_decode(
            generated_ids, skip_special_tokens=<span class="hljs-literal">False</span>
        )
        outputs = []
        <span class="hljs-keyword">for</span> image, annotation <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(images, annotations):
            outputs.append(
                components.image_annotator_processor.post_process_generation(
                    annotation, task=task, image_size=(image.width, image.height)
                )
            )
        <span class="hljs-keyword">return</span> outputs

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">prepare_mask</span>(<span class="hljs-params">self, images, annotations, overlay=<span class="hljs-literal">False</span>, fill=<span class="hljs-string">&quot;white&quot;</span></span>):
        masks = []
        <span class="hljs-keyword">for</span> image, annotation <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(images, annotations):
            mask_image = image.copy() <span class="hljs-keyword">if</span> overlay <span class="hljs-keyword">else</span> Image.new(<span class="hljs-string">&quot;L&quot;</span>, image.size, <span class="hljs-number">0</span>)
            draw = ImageDraw.Draw(mask_image)

            <span class="hljs-keyword">for</span> _, _annotation <span class="hljs-keyword">in</span> annotation.items():
                <span class="hljs-keyword">if</span> <span class="hljs-string">&quot;polygons&quot;</span> <span class="hljs-keyword">in</span> _annotation:
                    <span class="hljs-keyword">for</span> polygon <span class="hljs-keyword">in</span> _annotation[<span class="hljs-string">&quot;polygons&quot;</span>]:
                        polygon = np.array(polygon).reshape(-<span class="hljs-number">1</span>, <span class="hljs-number">2</span>)
                        <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(polygon) &lt; <span class="hljs-number">3</span>:
                            <span class="hljs-keyword">continue</span>
                        polygon = polygon.reshape(-<span class="hljs-number">1</span>).tolist()
                        draw.polygon(polygon, fill=fill)

                <span class="hljs-keyword">elif</span> <span class="hljs-string">&quot;bbox&quot;</span> <span class="hljs-keyword">in</span> _annotation:
                    bbox = _annotation[<span class="hljs-string">&quot;bbox&quot;</span>]
                    draw.rectangle(bbox, fill=<span class="hljs-string">&quot;white&quot;</span>)

            masks.append(mask_image)

        <span class="hljs-keyword">return</span> masks

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">prepare_bounding_boxes</span>(<span class="hljs-params">self, images, annotations</span>):
        outputs = []
        <span class="hljs-keyword">for</span> image, annotation <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(images, annotations):
            image_copy = image.copy()
            draw = ImageDraw.Draw(image_copy)
            <span class="hljs-keyword">for</span> _, _annotation <span class="hljs-keyword">in</span> annotation.items():
                bbox = _annotation[<span class="hljs-string">&quot;bbox&quot;</span>]
                label = _annotation[<span class="hljs-string">&quot;label&quot;</span>]

                draw.rectangle(bbox, outline=<span class="hljs-string">&quot;red&quot;</span>, width=<span class="hljs-number">3</span>)
                draw.text((bbox[<span class="hljs-number">0</span>], bbox[<span class="hljs-number">1</span>] - <span class="hljs-number">20</span>), label, fill=<span class="hljs-string">&quot;red&quot;</span>)

            outputs.append(image_copy)

        <span class="hljs-keyword">return</span> outputs

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">prepare_inputs</span>(<span class="hljs-params">self, images, prompts</span>):
        prompts = prompts <span class="hljs-keyword">or</span> <span class="hljs-string">&quot;&quot;</span>

        <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(images, Image.Image):
            images = [images]
        <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(prompts, <span class="hljs-built_in">str</span>):
            prompts = [prompts]

        <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(images) != <span class="hljs-built_in">len</span>(prompts):
            <span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">&quot;Number of images and annotation prompts must match.&quot;</span>)

        <span class="hljs-keyword">return</span> images, prompts

<span class="hljs-meta">    @torch.no_grad()</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state: PipelineState</span>) -&gt; PipelineState:
        block_state = self.get_block_state(state)
        images, annotation_task_prompt = self.prepare_inputs(
            block_state.image, block_state.annotation_prompt
        )
        task = block_state.annotation_task
        fill = block_state.fill

        annotations = self.get_annotations(
            components, images, annotation_task_prompt, task
        )
        block_state.annotations = annotations
        <span class="hljs-keyword">if</span> block_state.annotation_output_type == <span class="hljs-string">&quot;mask_image&quot;</span>:
            block_state.mask_image = self.prepare_mask(images, annotations)
        <span class="hljs-keyword">else</span>:
            block_state.mask_image = <span class="hljs-literal">None</span>

        <span class="hljs-keyword">if</span> block_state.annotation_output_type == <span class="hljs-string">&quot;mask_overlay&quot;</span>:
            block_state.image = self.prepare_mask(images, annotations, overlay=<span class="hljs-literal">True</span>, fill=fill)

        <span class="hljs-keyword">elif</span> block_state.annotation_output_type == <span class="hljs-string">&quot;bounding_box&quot;</span>:
            block_state.image = self.prepare_bounding_boxes(images, annotations)

        self.set_block_state(state, block_state)

        <span class="hljs-keyword">return</span> components, state
`,wrap:!1}}),G=new $l({props:{id:"share",options:["hf CLI","push_to_hub"],$$slots:{default:[Pl]},$$scope:{ctx:h}}}),N=new P({props:{title:"Using Custom Blocks",local:"using-custom-blocks",headingTag:"h2"}}),v=new d({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLm1vZHVsYXJfcGlwZWxpbmVzJTIwaW1wb3J0JTIwTW9kdWxhclBpcGVsaW5lQmxvY2tzJTJDJTIwU2VxdWVudGlhbFBpcGVsaW5lQmxvY2tzJTBBZnJvbSUyMGRpZmZ1c2Vycy5tb2R1bGFyX3BpcGVsaW5lcy5zdGFibGVfZGlmZnVzaW9uX3hsJTIwaW1wb3J0JTIwSU5QQUlOVF9CTE9DS1MlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQSUyMyUyMEZldGNoJTIwdGhlJTIwRmxvcmVuY2UyJTIwaW1hZ2UlMjBhbm5vdGF0b3IlMjBibG9jayUyMHRoYXQlMjB3aWxsJTIwY3JlYXRlJTIwb3VyJTIwbWFzayUwQWltYWdlX2Fubm90YXRvcl9ibG9jayUyMCUzRCUyME1vZHVsYXJQaXBlbGluZUJsb2Nrcy5mcm9tX3ByZXRyYWluZWQoJTIyZGlmZnVzZXJzJTJGZmxvcmVuY2UtMi1jdXN0b20tYmxvY2slMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBJTBBbXlfYmxvY2tzJTIwJTNEJTIwSU5QQUlOVF9CTE9DS1MuY29weSgpJTBBJTIzJTIwaW5zZXJ0JTIwdGhlJTIwYW5ub3RhdGlvbiUyMGJsb2NrJTIwYmVmb3JlJTIwdGhlJTIwaW1hZ2UlMjBlbmNvZGluZyUyMHN0ZXAlMEFteV9ibG9ja3MuaW5zZXJ0KCUyMmltYWdlX2Fubm90YXRvciUyMiUyQyUyMGltYWdlX2Fubm90YXRvcl9ibG9jayUyQyUyMDEpJTBBJTBBJTIzJTIwQ3JlYXRlJTIwb3VyJTIwaW5pdGlhbCUyMHNldCUyMG9mJTIwaW5wYWludGluZyUyMGJsb2NrcyUwQWJsb2NrcyUyMCUzRCUyMFNlcXVlbnRpYWxQaXBlbGluZUJsb2Nrcy5mcm9tX2Jsb2Nrc19kaWN0KG15X2Jsb2NrcyklMEElMEFyZXBvX2lkJTIwJTNEJTIwJTIyZGlmZnVzZXJzJTJGbW9kdWxhci1zdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTBBcGlwZSUyMCUzRCUyMGJsb2Nrcy5pbml0X3BpcGVsaW5lKHJlcG9faWQpJTBBcGlwZS5sb2FkX2NvbXBvbmVudHModG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwZGV2aWNlX21hcCUzRCUyMmN1ZGElMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBJTBBaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnRyYW5zZm9ybWVycyUyRnRhc2tzJTJGY2FyLmpwZyUzRmRvd25sb2FkJTNEdHJ1ZSUyMiklMEFpbWFnZSUyMCUzRCUyMGltYWdlLnJlc2l6ZSgoMTAyNCUyQyUyMDEwMjQpKSUwQSUwQXByb21wdCUyMCUzRCUyMCU1QiUyMkElMjByZWQlMjBjYXIlMjIlNUQlMEFhbm5vdGF0aW9uX3Rhc2slMjAlM0QlMjAlMjIlM0NSRUZFUlJJTkdfRVhQUkVTU0lPTl9TRUdNRU5UQVRJT04lM0UlMjIlMEFhbm5vdGF0aW9uX3Byb21wdCUyMCUzRCUyMCU1QiUyMnRoZSUyMGNhciUyMiU1RCUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMGFubm90YXRpb25fdGFzayUzRGFubm90YXRpb25fdGFzayUyQyUwQSUyMCUyMCUyMCUyMGFubm90YXRpb25fcHJvbXB0JTNEYW5ub3RhdGlvbl9wcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBhbm5vdGF0aW9uX291dHB1dF90eXBlJTNEJTIybWFza19pbWFnZSUyMiUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QzNSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENy41JTJDJTBBJTIwJTIwJTIwJTIwc3RyZW5ndGglM0QwLjk1JTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0JTNEJTIyaW1hZ2VzJTIyJTBBKSUwQW91dHB1dCU1QjAlNUQuc2F2ZSglMjJmbG9yZW5jZS1pbnBhaW50aW5nLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> ModularPipelineBlocks, SequentialPipelineBlocks
<span class="hljs-keyword">from</span> diffusers.modular_pipelines.stable_diffusion_xl <span class="hljs-keyword">import</span> INPAINT_BLOCKS
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

<span class="hljs-comment"># Fetch the Florence2 image annotator block that will create our mask</span>
image_annotator_block = ModularPipelineBlocks.from_pretrained(<span class="hljs-string">&quot;diffusers/florence-2-custom-block&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)

my_blocks = INPAINT_BLOCKS.copy()
<span class="hljs-comment"># insert the annotation block before the image encoding step</span>
my_blocks.insert(<span class="hljs-string">&quot;image_annotator&quot;</span>, image_annotator_block, <span class="hljs-number">1</span>)

<span class="hljs-comment"># Create our initial set of inpainting blocks</span>
blocks = SequentialPipelineBlocks.from_blocks_dict(my_blocks)

repo_id = <span class="hljs-string">&quot;diffusers/modular-stable-diffusion-xl-base-1.0&quot;</span>
pipe = blocks.init_pipeline(repo_id)
pipe.load_components(torch_dtype=torch.float16, device_map=<span class="hljs-string">&quot;cuda&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)

image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true&quot;</span>)
image = image.resize((<span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>))

prompt = [<span class="hljs-string">&quot;A red car&quot;</span>]
annotation_task = <span class="hljs-string">&quot;&lt;REFERRING_EXPRESSION_SEGMENTATION&gt;&quot;</span>
annotation_prompt = [<span class="hljs-string">&quot;the car&quot;</span>]

output = pipe(
    prompt=prompt,
    image=image,
    annotation_task=annotation_task,
    annotation_prompt=annotation_prompt,
    annotation_output_type=<span class="hljs-string">&quot;mask_image&quot;</span>,
    num_inference_steps=<span class="hljs-number">35</span>,
    guidance_scale=<span class="hljs-number">7.5</span>,
    strength=<span class="hljs-number">0.95</span>,
    output=<span class="hljs-string">&quot;images&quot;</span>
)
output[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;florence-inpainting.png&quot;</span>)`,wrap:!1}}),H=new P({props:{title:"Editing Custom Blocks",local:"editing-custom-blocks",headingTag:"h2"}}),q=new d({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLm1vZHVsYXJfcGlwZWxpbmVzJTIwaW1wb3J0JTIwTW9kdWxhclBpcGVsaW5lQmxvY2tzJTJDJTIwU2VxdWVudGlhbFBpcGVsaW5lQmxvY2tzJTBBZnJvbSUyMGRpZmZ1c2Vycy5tb2R1bGFyX3BpcGVsaW5lcy5zdGFibGVfZGlmZnVzaW9uX3hsJTIwaW1wb3J0JTIwSU5QQUlOVF9CTE9DS1MlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQSUyMyUyMEZldGNoJTIwdGhlJTIwRmxvcmVuY2UyJTIwaW1hZ2UlMjBhbm5vdGF0b3IlMjBibG9jayUyMHRoYXQlMjB3aWxsJTIwY3JlYXRlJTIwb3VyJTIwbWFzayUwQWltYWdlX2Fubm90YXRvcl9ibG9jayUyMCUzRCUyME1vZHVsYXJQaXBlbGluZUJsb2Nrcy5mcm9tX3ByZXRyYWluZWQoJTIyZGlmZnVzZXJzJTJGZmxvcmVuY2UtMi1jdXN0b20tYmxvY2slMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUlMkMlMjBsb2NhbF9kaXIlM0QlMjIlMkZteS1sb2NhbC1mb2xkZXIlMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> ModularPipelineBlocks, SequentialPipelineBlocks
<span class="hljs-keyword">from</span> diffusers.modular_pipelines.stable_diffusion_xl <span class="hljs-keyword">import</span> INPAINT_BLOCKS
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

<span class="hljs-comment"># Fetch the Florence2 image annotator block that will create our mask</span>
image_annotator_block = ModularPipelineBlocks.from_pretrained(<span class="hljs-string">&quot;diffusers/florence-2-custom-block&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>, local_dir=<span class="hljs-string">&quot;/my-local-folder&quot;</span>)`,wrap:!1}}),x=new ql({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/modular_diffusers/custom_blocks.md"}}),{c(){T=C("meta"),j=y(),a=C("p"),r=y(),U(w.$$.fragment),n=y(),U(m.$$.fragment),t=y(),u=C("p"),u.innerHTML=bl,L=y(),B=C("blockquote"),B.innerHTML=dl,O=y(),U(W.$$.fragment),K=y(),Z=C("p"),Z.textContent=hl,ll=y(),U(k.$$.fragment),Ml=y(),R=C("ul"),R.innerHTML=Bl,sl=y(),U(f.$$.fragment),Jl=y(),g=C("p"),g.innerHTML=Gl,Tl=y(),E=C("p"),E.innerHTML=Wl,wl=y(),U(Q.$$.fragment),al=y(),S=C("p"),S.textContent=Zl,yl=y(),U(V.$$.fragment),Il=y(),_=C("p"),_.innerHTML=kl,tl=y(),U(F.$$.fragment),nl=y(),X=C("p"),X.innerHTML=Rl,jl=y(),U(G.$$.fragment),Ul=y(),U(N.$$.fragment),el=y(),Y=C("p"),Y.innerHTML=fl,pl=y(),U(v.$$.fragment),ol=y(),U(H.$$.fragment),Al=y(),z=C("p"),z.innerHTML=gl,il=y(),U(q.$$.fragment),Cl=y(),$=C("p"),$.textContent=El,cl=y(),U(x.$$.fragment),ml=y(),D=C("p"),this.h()},l(l){const M=vl("svelte-u9bgzb",document.head);T=c(M,"META",{name:!0,content:!0}),M.forEach(s),j=I(l),a=c(l,"P",{}),Sl(a).forEach(s),r=I(l),e(w.$$.fragment,l),n=I(l),e(m.$$.fragment,l),t=I(l),u=c(l,"P",{"data-svelte-h":!0}),b(u)!=="svelte-14lvzlb"&&(u.innerHTML=bl),L=I(l),B=c(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),b(B)!=="svelte-4vw3mg"&&(B.innerHTML=dl),O=I(l),e(W.$$.fragment,l),K=I(l),Z=c(l,"P",{"data-svelte-h":!0}),b(Z)!=="svelte-vxw3lv"&&(Z.textContent=hl),ll=I(l),e(k.$$.fragment,l),Ml=I(l),R=c(l,"UL",{"data-svelte-h":!0}),b(R)!=="svelte-lnhirc"&&(R.innerHTML=Bl),sl=I(l),e(f.$$.fragment,l),Jl=I(l),g=c(l,"P",{"data-svelte-h":!0}),b(g)!=="svelte-1slfrb7"&&(g.innerHTML=Gl),Tl=I(l),E=c(l,"P",{"data-svelte-h":!0}),b(E)!=="svelte-1by29uj"&&(E.innerHTML=Wl),wl=I(l),e(Q.$$.fragment,l),al=I(l),S=c(l,"P",{"data-svelte-h":!0}),b(S)!=="svelte-1omm6lj"&&(S.textContent=Zl),yl=I(l),e(V.$$.fragment,l),Il=I(l),_=c(l,"P",{"data-svelte-h":!0}),b(_)!=="svelte-131wlzd"&&(_.innerHTML=kl),tl=I(l),e(F.$$.fragment,l),nl=I(l),X=c(l,"P",{"data-svelte-h":!0}),b(X)!=="svelte-vykhta"&&(X.innerHTML=Rl),jl=I(l),e(G.$$.fragment,l),Ul=I(l),e(N.$$.fragment,l),el=I(l),Y=c(l,"P",{"data-svelte-h":!0}),b(Y)!=="svelte-n2ss7u"&&(Y.innerHTML=fl),pl=I(l),e(v.$$.fragment,l),ol=I(l),e(H.$$.fragment,l),Al=I(l),z=c(l,"P",{"data-svelte-h":!0}),b(z)!=="svelte-1bfjoip"&&(z.innerHTML=gl),il=I(l),e(q.$$.fragment,l),Cl=I(l),$=c(l,"P",{"data-svelte-h":!0}),b($)!=="svelte-fe2x3t"&&($.textContent=El),cl=I(l),e(x.$$.fragment,l),ml=I(l),D=c(l,"P",{}),Sl(D).forEach(s),this.h()},h(){ul(T,"name","hf:doc:metadata"),ul(T,"content",Ol),ul(B,"class","tip")},m(l,M){Hl(document.head,T),J(l,j,M),J(l,a,M),J(l,r,M),p(w,l,M),J(l,n,M),p(m,l,M),J(l,t,M),J(l,u,M),J(l,L,M),J(l,B,M),J(l,O,M),p(W,l,M),J(l,K,M),J(l,Z,M),J(l,ll,M),p(k,l,M),J(l,Ml,M),J(l,R,M),J(l,sl,M),p(f,l,M),J(l,Jl,M),J(l,g,M),J(l,Tl,M),J(l,E,M),J(l,wl,M),p(Q,l,M),J(l,al,M),J(l,S,M),J(l,yl,M),p(V,l,M),J(l,Il,M),J(l,_,M),J(l,tl,M),p(F,l,M),J(l,nl,M),J(l,X,M),J(l,jl,M),p(G,l,M),J(l,Ul,M),p(N,l,M),J(l,el,M),J(l,Y,M),J(l,pl,M),p(v,l,M),J(l,ol,M),p(H,l,M),J(l,Al,M),J(l,z,M),J(l,il,M),p(q,l,M),J(l,Cl,M),J(l,$,M),J(l,cl,M),p(x,l,M),J(l,ml,M),J(l,D,M),rl=!0},p(l,[M]){const Ql={};M&2&&(Ql.$$scope={dirty:M,ctx:l}),G.$set(Ql)},i(l){rl||(o(w.$$.fragment,l),o(m.$$.fragment,l),o(W.$$.fragment,l),o(k.$$.fragment,l),o(f.$$.fragment,l),o(Q.$$.fragment,l),o(V.$$.fragment,l),o(F.$$.fragment,l),o(G.$$.fragment,l),o(N.$$.fragment,l),o(v.$$.fragment,l),o(H.$$.fragment,l),o(q.$$.fragment,l),o(x.$$.fragment,l),rl=!0)},o(l){A(w.$$.fragment,l),A(m.$$.fragment,l),A(W.$$.fragment,l),A(k.$$.fragment,l),A(f.$$.fragment,l),A(Q.$$.fragment,l),A(V.$$.fragment,l),A(F.$$.fragment,l),A(G.$$.fragment,l),A(N.$$.fragment,l),A(v.$$.fragment,l),A(H.$$.fragment,l),A(q.$$.fragment,l),A(x.$$.fragment,l),rl=!1},d(l){l&&(s(j),s(a),s(r),s(n),s(t),s(u),s(L),s(B),s(O),s(K),s(Z),s(ll),s(Ml),s(R),s(sl),s(Jl),s(g),s(Tl),s(E),s(wl),s(al),s(S),s(yl),s(Il),s(_),s(tl),s(nl),s(X),s(jl),s(Ul),s(el),s(Y),s(pl),s(ol),s(Al),s(z),s(il),s(Cl),s($),s(cl),s(ml),s(D)),s(T),i(w,l),i(m,l),i(W,l),i(k,l),i(f,l),i(Q,l),i(V,l),i(F,l),i(G,l),i(N,l),i(v,l),i(H,l),i(q,l),i(x,l)}}}const Ol='{"title":"Building Custom Blocks","local":"building-custom-blocks","sections":[{"title":"Project Structure","local":"project-structure","sections":[],"depth":2},{"title":"Example: Florence 2 Inpainting Block","local":"example-florence-2-inpainting-block","sections":[],"depth":2},{"title":"Using Custom Blocks","local":"using-custom-blocks","sections":[],"depth":2},{"title":"Editing Custom Blocks","local":"editing-custom-blocks","sections":[],"depth":2}],"depth":1}';function Kl(h){return Xl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class aM extends Nl{constructor(T){super(),Yl(this,T,Kl,Ll,Fl,{})}}export{aM as component};
