import{s as Me,o as be,n as ye}from"../chunks/scheduler.53228c21.js";import{S as we,i as je,e as c,s as a,c as f,h as Te,a as r,d as n,b as i,f as X,j as S,g as h,k as E,l as U,m as s,n as g,t as _,o as M,p as b}from"../chunks/index.100fac89.js";import{C as Je}from"../chunks/CopyLLMTxtMenu.999d3d86.js";import{D as pe}from"../chunks/Docstring.46d0934e.js";import{C as Ue}from"../chunks/CodeBlock.d30a6509.js";import{E as Se}from"../chunks/ExampleCodeBlock.9c663ca1.js";import{H as de,E as Ie}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function ve(H){let l,I="Examples:",m,d,p;return d=new Ue({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU2VtYW50aWNTdGFibGVEaWZmdXNpb25QaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBTZW1hbnRpY1N0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFvdXQlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwdGhlJTIwZmFjZSUyMG9mJTIwYSUyMHdvbWFuJTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ltYWdlc19wZXJfcHJvbXB0JTNEMSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENyUyQyUwQSUyMCUyMCUyMCUyMGVkaXRpbmdfcHJvbXB0JTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc21pb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W1hZ2UlMjAlM0QlMjBvdXQuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> SemanticStableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = SemanticStableDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>out = pipe(
<span class="hljs-meta">... </span>    prompt=<span class="hljs-string">&quot;a photo of the face of a woman&quot;</span>,
<span class="hljs-meta">... </span>    num_images_per_prompt=<span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">7</span>,
<span class="hljs-meta">... </span>    editing_prompt=[
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;smiling, smile&quot;</span>,  <span class="hljs-comment"># Concepts to apply</span>
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;glasses, wearing glasses&quot;</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;curls, wavy hair, curly hair&quot;</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;beard, full beard, mustache&quot;</span>,
<span class="hljs-meta">... </span>    ],
<span class="hljs-meta">... </span>    reverse_editing_direction=[
<span class="hljs-meta">... </span>        <span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>        <span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>        <span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>        <span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    ],  <span class="hljs-comment"># Direction of guidance i.e. increase all concepts</span>
<span class="hljs-meta">... </span>    edit_warmup_steps=[<span class="hljs-number">10</span>, <span class="hljs-number">10</span>, <span class="hljs-number">10</span>, <span class="hljs-number">10</span>],  <span class="hljs-comment"># Warmup period for each concept</span>
<span class="hljs-meta">... </span>    edit_guidance_scale=[<span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">5</span>, <span class="hljs-number">5.4</span>],  <span class="hljs-comment"># Guidance scale for each concept</span>
<span class="hljs-meta">... </span>    edit_threshold=[
<span class="hljs-meta">... </span>        <span class="hljs-number">0.99</span>,
<span class="hljs-meta">... </span>        <span class="hljs-number">0.975</span>,
<span class="hljs-meta">... </span>        <span class="hljs-number">0.925</span>,
<span class="hljs-meta">... </span>        <span class="hljs-number">0.96</span>,
<span class="hljs-meta">... </span>    ],  <span class="hljs-comment"># Threshold for each concept. Threshold equals the percentile of the latent space that will be discarded. I.e. threshold=0.99 uses 1% of the latent dimensions</span>
<span class="hljs-meta">... </span>    edit_momentum_scale=<span class="hljs-number">0.3</span>,  <span class="hljs-comment"># Momentum scale that will be added to the latent guidance</span>
<span class="hljs-meta">... </span>    edit_mom_beta=<span class="hljs-number">0.6</span>,  <span class="hljs-comment"># Momentum beta</span>
<span class="hljs-meta">... </span>    edit_weights=[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>],  <span class="hljs-comment"># Weights of the individual concepts against each other</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = out.images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){l=c("p"),l.textContent=I,m=a(),f(d.$$.fragment)},l(o){l=r(o,"P",{"data-svelte-h":!0}),S(l)!=="svelte-kvfsh7"&&(l.textContent=I),m=i(o),h(d.$$.fragment,o)},m(o,j){s(o,l,j),s(o,m,j),g(d,o,j),p=!0},p:ye,i(o){p||(_(d.$$.fragment,o),p=!0)},o(o){M(d.$$.fragment,o),p=!1},d(o){o&&(n(l),n(m)),b(d,o)}}}function xe(H){let l,I,m,d,p,o="<p>This pipeline is deprecated but it can still be used. However, we won’t test the pipeline anymore and won’t accept any changes to it. If you run into any issues, reinstall the last Diffusers version that supported this model.</p>",j,v,V,x,z,C,me=`Semantic Guidance for Diffusion Models was proposed in <a href="https://huggingface.co/papers/2301.12247" rel="nofollow">SEGA: Instructing Text-to-Image Models using Semantic Guidance</a> and provides strong semantic control over image generation.
Small changes to the text prompt usually result in entirely different output images. However, with SEGA a variety of changes to the image are enabled that can be controlled easily and intuitively, while staying true to the original image composition.`,F,G,ue="The abstract from the paper is:",O,D,fe="<em>Text-to-image diffusion models have recently received a lot of interest for their astonishing ability to produce high-fidelity images from text only. However, achieving one-shot generation that aligns with the user’s intent is nearly impossible, yet small changes to the input prompt often result in very different images. This leaves the user with little semantic control. To put the user in control, we show how to interact with the diffusion process to flexibly steer it along semantic directions. This semantic guidance (SEGA) generalizes to any generative architecture using classifier-free guidance. More importantly, it allows for subtle and extensive edits, changes in composition and style, as well as optimizing the overall artistic conception. We demonstrate SEGA’s effectiveness on both latent and pixel-based diffusion models such as Stable Diffusion, Paella, and DeepFloyd-IF using a variety of tasks, thus providing strong evidence for its versatility, flexibility, and improvements over existing methods.</em>",R,T,he='<p>Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-a-pipeline">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.</p>',q,$,K,y,A,le,u,k,oe,Z,ge="The call function to the pipeline for generation.",ce,J,ee,B,te,w,P,re,W,_e="Output class for Stable Diffusion pipelines.",ne,N,se,Y,ae;return v=new Je({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new de({props:{title:"Semantic Guidance",local:"semantic-guidance",headingTag:"h1"}}),$=new de({props:{title:"SemanticStableDiffusionPipeline",local:"diffusers.SemanticStableDiffusionPipeline",headingTag:"h2"}}),A=new pe({props:{name:"class diffusers.SemanticStableDiffusionPipeline",anchor:"diffusers.SemanticStableDiffusionPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py#L28"}}),k=new pe({props:{name:"__call__",anchor:"diffusers.SemanticStableDiffusionPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Optional[typing.Callable[[int, int, torch.Tensor], NoneType]] = None"},{name:"callback_steps",val:": int = 1"},{name:"editing_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"editing_prompt_embeddings",val:": typing.Optional[torch.Tensor] = None"},{name:"reverse_editing_direction",val:": typing.Union[bool, typing.List[bool], NoneType] = False"},{name:"edit_guidance_scale",val:": typing.Union[float, typing.List[float], NoneType] = 5"},{name:"edit_warmup_steps",val:": typing.Union[int, typing.List[int], NoneType] = 10"},{name:"edit_cooldown_steps",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"edit_threshold",val:": typing.Union[float, typing.List[float], NoneType] = 0.9"},{name:"edit_momentum_scale",val:": typing.Optional[float] = 0.1"},{name:"edit_mom_beta",val:": typing.Optional[float] = 0.4"},{name:"edit_weights",val:": typing.Optional[typing.List[float]] = None"},{name:"sem_guidance",val:": typing.Optional[typing.List[torch.Tensor]] = None"}],parametersDescription:[{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide image generation.`,name:"prompt"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 1</code>).`,name:"negative_prompt"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://huggingface.co/papers/2010.02502" rel="nofollow">DDIM</a> paper. Only
applies to the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/depth2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls every <code>callback_steps</code> steps during inference. The function is called with the
following arguments: <code>callback(step: int, timestep: int, latents: torch.Tensor)</code>.`,name:"callback"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function is called. If not specified, the callback is called at
every step.`,name:"callback_steps"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.editing_prompt",description:`<strong>editing_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to use for semantic guidance. Semantic guidance is disabled by setting
<code>editing_prompt = None</code>. Guidance direction of prompt should be specified via
<code>reverse_editing_direction</code>.`,name:"editing_prompt"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.editing_prompt_embeddings",description:`<strong>editing_prompt_embeddings</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-computed embeddings to use for semantic guidance. Guidance direction of embedding should be
specified via <code>reverse_editing_direction</code>.`,name:"editing_prompt_embeddings"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.reverse_editing_direction",description:`<strong>reverse_editing_direction</strong> (<code>bool</code> or <code>List[bool]</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the corresponding prompt in <code>editing_prompt</code> should be increased or decreased.`,name:"reverse_editing_direction"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_guidance_scale",description:`<strong>edit_guidance_scale</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to 5) &#x2014;
Guidance scale for semantic guidance. If provided as a list, values should correspond to
<code>editing_prompt</code>.`,name:"edit_guidance_scale"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_warmup_steps",description:`<strong>edit_warmup_steps</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to 10) &#x2014;
Number of diffusion steps (for each prompt) for which semantic guidance is not applied. Momentum is
calculated for those steps and applied once all warmup periods are over.`,name:"edit_warmup_steps"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_cooldown_steps",description:`<strong>edit_cooldown_steps</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Number of diffusion steps (for each prompt) after which semantic guidance is longer applied.`,name:"edit_cooldown_steps"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_threshold",description:`<strong>edit_threshold</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to 0.9) &#x2014;
Threshold of semantic guidance.`,name:"edit_threshold"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_momentum_scale",description:`<strong>edit_momentum_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Scale of the momentum to be added to the semantic guidance at each diffusion step. If set to 0.0,
momentum is disabled. Momentum is already built up during warmup (for diffusion steps smaller than
<code>sld_warmup_steps</code>). Momentum is only added to latent guidance once all warmup periods are finished.`,name:"edit_momentum_scale"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_mom_beta",description:`<strong>edit_mom_beta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.4) &#x2014;
Defines how semantic guidance momentum builds up. <code>edit_mom_beta</code> indicates how much of the previous
momentum is kept. Momentum is already built up during warmup (for diffusion steps smaller than
<code>edit_warmup_steps</code>).`,name:"edit_mom_beta"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.edit_weights",description:`<strong>edit_weights</strong> (<code>List[float]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Indicates how much each individual concept should influence the overall guidance. If no weights are
provided all concepts are applied equally.`,name:"edit_weights"},{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.sem_guidance",description:`<strong>sem_guidance</strong> (<code>List[torch.Tensor]</code>, <em>optional</em>) &#x2014;
List of pre-generated guidance vectors to be applied at generation. Length of the list has to
correspond to <code>num_inference_steps</code>.`,name:"sem_guidance"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py#L223",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>,
<code>~pipelines.semantic_stable_diffusion.SemanticStableDiffusionPipelineOutput</code> is returned, otherwise a
<code>tuple</code> is returned where the first element is a list with the generated images and the second element
is a list of <code>bool</code>s indicating whether the corresponding generated image contains “not-safe-for-work”
(nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.semantic_stable_diffusion.SemanticStableDiffusionPipelineOutput</code> or <code>tuple</code></p>
`}}),J=new Se({props:{anchor:"diffusers.SemanticStableDiffusionPipeline.__call__.example",$$slots:{default:[ve]},$$scope:{ctx:H}}}),B=new de({props:{title:"SemanticStableDiffusionPipelineOutput",local:"diffusers.pipelines.semantic_stable_diffusion.pipeline_output.SemanticStableDiffusionPipelineOutput",headingTag:"h2"}}),P=new pe({props:{name:"class diffusers.pipelines.semantic_stable_diffusion.pipeline_output.SemanticStableDiffusionPipelineOutput",anchor:"diffusers.pipelines.semantic_stable_diffusion.pipeline_output.SemanticStableDiffusionPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],parametersDescription:[{anchor:"diffusers.pipelines.semantic_stable_diffusion.pipeline_output.SemanticStableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.semantic_stable_diffusion.pipeline_output.SemanticStableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content or
<code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_output.py#L11"}}),N=new Ie({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/semantic_stable_diffusion.md"}}),{c(){l=c("meta"),I=a(),m=c("p"),d=a(),p=c("blockquote"),p.innerHTML=o,j=a(),f(v.$$.fragment),V=a(),f(x.$$.fragment),z=a(),C=c("p"),C.innerHTML=me,F=a(),G=c("p"),G.textContent=ue,O=a(),D=c("p"),D.innerHTML=fe,R=a(),T=c("blockquote"),T.innerHTML=he,q=a(),f($.$$.fragment),K=a(),y=c("div"),f(A.$$.fragment),le=a(),u=c("div"),f(k.$$.fragment),oe=a(),Z=c("p"),Z.textContent=ge,ce=a(),f(J.$$.fragment),ee=a(),f(B.$$.fragment),te=a(),w=c("div"),f(P.$$.fragment),re=a(),W=c("p"),W.textContent=_e,ne=a(),f(N.$$.fragment),se=a(),Y=c("p"),this.h()},l(e){const t=Te("svelte-u9bgzb",document.head);l=r(t,"META",{name:!0,content:!0}),t.forEach(n),I=i(e),m=r(e,"P",{}),X(m).forEach(n),d=i(e),p=r(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),S(p)!=="svelte-124tjg"&&(p.innerHTML=o),j=i(e),h(v.$$.fragment,e),V=i(e),h(x.$$.fragment,e),z=i(e),C=r(e,"P",{"data-svelte-h":!0}),S(C)!=="svelte-1zh9ed"&&(C.innerHTML=me),F=i(e),G=r(e,"P",{"data-svelte-h":!0}),S(G)!=="svelte-1cwsb16"&&(G.textContent=ue),O=i(e),D=r(e,"P",{"data-svelte-h":!0}),S(D)!=="svelte-1vzoat7"&&(D.innerHTML=fe),R=i(e),T=r(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),S(T)!=="svelte-r1jcqf"&&(T.innerHTML=he),q=i(e),h($.$$.fragment,e),K=i(e),y=r(e,"DIV",{class:!0});var L=X(y);h(A.$$.fragment,L),le=i(L),u=r(L,"DIV",{class:!0});var Q=X(u);h(k.$$.fragment,Q),oe=i(Q),Z=r(Q,"P",{"data-svelte-h":!0}),S(Z)!=="svelte-50j04k"&&(Z.textContent=ge),ce=i(Q),h(J.$$.fragment,Q),Q.forEach(n),L.forEach(n),ee=i(e),h(B.$$.fragment,e),te=i(e),w=r(e,"DIV",{class:!0});var ie=X(w);h(P.$$.fragment,ie),re=i(ie),W=r(ie,"P",{"data-svelte-h":!0}),S(W)!=="svelte-1qpjiuf"&&(W.textContent=_e),ie.forEach(n),ne=i(e),h(N.$$.fragment,e),se=i(e),Y=r(e,"P",{}),X(Y).forEach(n),this.h()},h(){E(l,"name","hf:doc:metadata"),E(l,"content",Ce),E(p,"class","warning"),E(T,"class","tip"),E(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){U(document.head,l),s(e,I,t),s(e,m,t),s(e,d,t),s(e,p,t),s(e,j,t),g(v,e,t),s(e,V,t),g(x,e,t),s(e,z,t),s(e,C,t),s(e,F,t),s(e,G,t),s(e,O,t),s(e,D,t),s(e,R,t),s(e,T,t),s(e,q,t),g($,e,t),s(e,K,t),s(e,y,t),g(A,y,null),U(y,le),U(y,u),g(k,u,null),U(u,oe),U(u,Z),U(u,ce),g(J,u,null),s(e,ee,t),g(B,e,t),s(e,te,t),s(e,w,t),g(P,w,null),U(w,re),U(w,W),s(e,ne,t),g(N,e,t),s(e,se,t),s(e,Y,t),ae=!0},p(e,[t]){const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),J.$set(L)},i(e){ae||(_(v.$$.fragment,e),_(x.$$.fragment,e),_($.$$.fragment,e),_(A.$$.fragment,e),_(k.$$.fragment,e),_(J.$$.fragment,e),_(B.$$.fragment,e),_(P.$$.fragment,e),_(N.$$.fragment,e),ae=!0)},o(e){M(v.$$.fragment,e),M(x.$$.fragment,e),M($.$$.fragment,e),M(A.$$.fragment,e),M(k.$$.fragment,e),M(J.$$.fragment,e),M(B.$$.fragment,e),M(P.$$.fragment,e),M(N.$$.fragment,e),ae=!1},d(e){e&&(n(I),n(m),n(d),n(p),n(j),n(V),n(z),n(C),n(F),n(G),n(O),n(D),n(R),n(T),n(q),n(K),n(y),n(ee),n(te),n(w),n(ne),n(se),n(Y)),n(l),b(v,e),b(x,e),b($,e),b(A),b(k),b(J),b(B,e),b(P),b(N,e)}}}const Ce='{"title":"Semantic Guidance","local":"semantic-guidance","sections":[{"title":"SemanticStableDiffusionPipeline","local":"diffusers.SemanticStableDiffusionPipeline","sections":[],"depth":2},{"title":"SemanticStableDiffusionPipelineOutput","local":"diffusers.pipelines.semantic_stable_diffusion.pipeline_output.SemanticStableDiffusionPipelineOutput","sections":[],"depth":2}],"depth":1}';function Ge(H){return be(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Le extends we{constructor(l){super(),je(this,l,Ge,xe,Me,{})}}export{Le as component};
