Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Stable Diffusion iş akışları","local":"stable-diffusion-pipelines","sections":[{"title":"İpuçları","local":"tips","sections":[{"title":"Hız ve kalite arasındaki ödünleşimi keşfedin","local":"explore-tradeoff-between-speed-and-quality","sections":[],"depth":3},{"title":"Bellek tasarrufu için pipeline bileşenlerini yeniden kullanın","local":"reuse-pipeline-components-to-save-memory","sections":[],"depth":3},{"title":"gradio kullanarak web demoları oluşturun","local":"create-web-demos-using-gradio","sections":[],"depth":3}],"depth":2}],"depth":1}"/> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/start.vZc-dOUR.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/Bafuik5c.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/Bupkjr9f.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/app.B6c3Ml05.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CyvZ3FS5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/l0QnnOED.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DnVIJfC5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/0.BQlx092V.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CoSrdQax.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/247.CLMyIkNk.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/B4AMoTAu.js" rel="modulepreload"> | |
| <!--17yjmkr--><meta name="hf:doc:metadata" content="{"title":"Stable Diffusion pipelines","local":"stable-diffusion-pipelines","sections":[{"title":"Tips","local":"tips","sections":[{"title":"Explore tradeoff between speed and quality","local":"explore-tradeoff-between-speed-and-quality","sections":[],"depth":3},{"title":"Reuse pipeline components to save memory","local":"reuse-pipeline-components-to-save-memory","sections":[],"depth":3},{"title":"Create web demos using gradio","local":"create-web-demos-using-gradio","sections":[],"depth":3}],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/diffusers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="stable-diffusion-pipelines" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#stable-diffusion-pipelines"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Stable Diffusion iş akışları<!----></span></h1><!--]--><!----> <div class="flex flex-wrap space-x-1"><img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/></div> <p>Stable Diffusion, <a href="https://github.com/CompVis" rel="nofollow">CompVis</a>, <a href="https://stability.ai/" rel="nofollow">Stability AI</a> ve <a href="https://laion.ai/" rel="nofollow">LAION</a> araştırmacıları ve mühendisleri tarafından geliştirilen bir metinden görüntüye latent difüzyon modelidir. Latent difüzyon, bellek ve hesaplama karmaşıklığını azaltmak için difüzyon sürecini daha düşük boyutlu bir latent uzayda uygular. Bu spesifik difüzyon modeli türü, Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser ve Björn Ommer tarafından <a href="https://huggingface.co/papers/2112.10752" rel="nofollow">High-Resolution Image Synthesis with Latent Diffusion Models</a> makalesinde önerilmiştir.</p> <p>Stable Diffusion, LAION-5B veri setinin bir alt kümesindeki 512x512 boyutundaki görseller üzerinde eğitilmiştir. Bu model, metin istemlerine göre koşullandırmak için dondurulmuş bir CLIP ViT-L/14 metin kodlayıcı kullanır. 860M parametreli UNet ve 123M parametreli metin kodlayıcısıyla model nispeten hafiftir ve tüketici sınıfı GPU'larda çalıştırılabilir.</p> <p>Stable Diffusion'un nasıl çalıştığı ve temel latent difüzyon modelinden nasıl farklılaştığına dair daha fazla ayrıntı için Stability AI'nin <a href="https://stability.ai/blog/stable-diffusion-announcement" rel="nofollow">düzenlemesini</a> ve daha teknik ayrıntılar için kendi <a href="https://huggingface.co/blog/stable_diffusion#how-does-stable-diffusion-work" rel="nofollow">blog yazımızı</a> inceleyin.</p> <p>Stable Diffusion v1.0'ın orijinal kod tabanını <a href="https://github.com/CompVis/stable-diffusion" rel="nofollow">CompVis/stable-diffusion</a> adresinde, Stable Diffusion v2.0'ınkini ise <a href="https://github.com/Stability-AI/stablediffusion" rel="nofollow">Stability-AI/stablediffusion</a> adresinde ve çeşitli görevler için orijinal betiklerini bulabilirsiniz. Farklı Stable Diffusion sürümleri ve görevleri için ek resmi kontrol noktaları, <a href="https://huggingface.co/CompVis" rel="nofollow">CompVis</a> ve <a href="https://huggingface.co/stabilityai" rel="nofollow">Stability AI</a> Hub kuruluşlarında yer almaktadır. Kullanım senaryonuza en uygun kontrol noktasını bulmak için bu kuruluşları keşfedin!</p> <p>Aşağıdaki tablo, mevcut Stable Diffusion hatlarını, desteklenen görevlerini ve etkileşimli bir demosunu özetlemektedir:</p> <div class="flex justify-center"><div class="rounded-xl border border-gray-200"><table class="min-w-full divide-y-2 divide-gray-200 bg-white text-sm"><thead><tr><th class="px-4 py-2 font-medium text-gray-900 text-left">Pipeline</th><th class="px-4 py-2 font-medium text-gray-900 text-left">Desteklenen görevler</th><th class="px-4 py-2 font-medium text-gray-900 text-left">🤗 Alan</th></tr></thead><tbody class="divide-y divide-gray-200"><tr><td class="px-4 py-2 text-gray-700"><a href="./text2img">StableDiffusion</a></td><td class="px-4 py-2 text-gray-700">metinden görüntüye</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/stabilityai/stable-diffusion"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./img2img">StableDiffusionImg2Img</a></td><td class="px-4 py-2 text-gray-700">görselden görseli</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/huggingface/diffuse-the-rest"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./inpaint">StableDiffusionInpaint</a></td><td class="px-4 py-2 text-gray-700">inpainting</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/stable-diffusion-v1-5/stable-diffusion-inpainting"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./depth2img">StableDiffusionDepth2Img</a></td><td class="px-4 py-2 text-gray-700">derinlikten görüntüye</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/radames/stable-diffusion-depth2img"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./image_variation">StableDiffusionImageVariation</a></td><td class="px-4 py-2 text-gray-700">görsel çeşitliliği</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/lambdalabs/stable-diffusion-image-variations"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700">StableDiffusionPipelineSafe (kullanımdan kaldırıldı; doküman sayfası yok)</td><td class="px-4 py-2 text-gray-700">filtrelenmiş metinden görüntüye</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/AIML-TUDA/unsafe-vs-safe-stable-diffusion"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./stable_diffusion_2">StableDiffusion2</a></td><td class="px-4 py-2 text-gray-700">metinden görüntüye, inpainting, derinlikten görüntüye, süper çözünürlük</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/stabilityai/stable-diffusion"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./stable_diffusion_xl">StableDiffusionXL</a></td><td class="px-4 py-2 text-gray-700">metinden görüntüye, görüntüden görüntüye</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/RamAnanth1/stable-diffusion-xl"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./latent_upscale">StableDiffusionLatentUpscale</a></td><td class="px-4 py-2 text-gray-700">super-resolution</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/huggingface-projects/stable-diffusion-latent-upscaler"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./upscale">StableDiffusionUpscale</a></td><td class="px-4 py-2 text-gray-700">super-resolution</td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./ldm3d_diffusion">StableDiffusionLDM3D</a></td><td class="px-4 py-2 text-gray-700">metinden-renge, metinden-derinliğe, metinden-panoramaya</td><td class="px-4 py-2"><a href="https://huggingface.co/spaces/r23/ldm3d-space"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a></td></tr><tr><td class="px-4 py-2 text-gray-700"><a href="./ldm3d_diffusion">StableDiffusionUpscaleLDM3D</a></td><td class="px-4 py-2 text-gray-700">ldm3d süper çözünürlük</td></tr></tbody></table></div></div> <!--[1--><h2 class="relative group"><a id="tips" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#tips"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->İpuçları<!----></span></h2><!--]--><!----> <p>Stable Diffusion pipeline'lerinden en iyi verimi almanıza yardımcı olmak için, performans ve kullanılabilirliği artırmaya yönelik birkaç ipucu aşağıda verilmiştir. Bu ipuçları tüm Stable Diffusion pipeline'ları için geçerlidir.</p> <!--[2--><h3 class="relative group"><a id="explore-tradeoff-between-speed-and-quality" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#explore-tradeoff-between-speed-and-quality"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Hız ve kalite arasındaki ödünleşimi keşfedin<!----></span></h3><!--]--><!----> <p><a href="/docs/diffusers/main/tr/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline">StableDiffusionPipeline</a> varsayılan olarak <a href="/docs/diffusers/main/tr/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a> kullanır ancak 🤗 Diffusers, uyumlu birçok başka zamanlayıcı (bunlardan bazıları daha hızlıdır veya daha iyi kalitede çıktı üretir) sunar. Örneğin, varsayılan yerine <a href="/docs/diffusers/main/tr/api/schedulers/euler#diffusers.EulerDiscreteScheduler">EulerDiscreteScheduler</a> kullanmak istiyorsanız:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, EulerDiscreteScheduler | |
| pipeline = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">"CompVis/stable-diffusion-v1-4"</span>) | |
| pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config) | |
| <span class="hljs-comment"># or</span> | |
| euler_scheduler = EulerDiscreteScheduler.from_pretrained(<span class="hljs-string">"CompVis/stable-diffusion-v1-4"</span>, subfolder=<span class="hljs-string">"scheduler"</span>) | |
| pipeline = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">"CompVis/stable-diffusion-v1-4"</span>, scheduler=euler_scheduler)<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="reuse-pipeline-components-to-save-memory" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#reuse-pipeline-components-to-save-memory"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Bellek tasarrufu için pipeline bileşenlerini yeniden kullanın<!----></span></h3><!--]--><!----> <p>Belleği tasarruflu kullanmak ve aynı bileşenleri birden çok iş akışında kullanmak için, ağırlıkların RAM'e birden fazla kez yüklenmesini önlemek amacıyla <code>.components</code> yöntemini kullanın.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ( | |
| StableDiffusionPipeline, | |
| StableDiffusionImg2ImgPipeline, | |
| StableDiffusionInpaintPipeline, | |
| ) | |
| text2img = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">"CompVis/stable-diffusion-v1-4"</span>) | |
| img2img = StableDiffusionImg2ImgPipeline(**text2img.components) | |
| inpaint = StableDiffusionInpaintPipeline(**text2img.components) | |
| <span class="hljs-comment"># now you can use text2img(...), img2img(...), inpaint(...) just like the call methods of each respective pipeline</span><!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="create-web-demos-using-gradio" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#create-web-demos-using-gradio"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->gradio kullanarak web demoları oluşturun<!----></span></h3><!--]--><!----> <p>Stable Diffusion pipeline'leri, web üzerinde güzel ve kullanıcı dostu makine öğrenmesi uygulamaları oluşturmayı kolaylaştıran <a href="https://github.com/gradio-app/gradio/" rel="nofollow">Gradio</a> kütüphanesinde otomatik olarak desteklenir. Öncelikle Gradio'nun yüklü olduğundan emin olun:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-sh "><!---->pip install -U gradio<!----></pre></div><!----> <p>Ardından, herhangi bir Stable Diffusion tabanlı bir pipeline etrafında bir web demosu oluşturun. Örneğin, Gradio'nun <a href="https://www.gradio.app/docs/interface#interface-from-pipeline" rel="nofollow"><code>Interface.from_pipeline</code></a> işleviyle tek satır kodda bir görüntü oluşturma pipeline'ı oluşturabilirsiniz:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline | |
| <span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr | |
| pipe = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">"CompVis/stable-diffusion-v1-4"</span>) | |
| gr.Interface.from_pipeline(pipe).launch()<!----></pre></div><!----> <p>tarayıcınızda sezgisel bir sürükle-bırak arayüzü açar:</p> <p><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/gradio-panda.png"/></p> <p>Benzer şekilde, bir görüntüden görüntüye hattı için bir demo oluşturabilirsiniz:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionImg2ImgPipeline | |
| <span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr | |
| pipe = StableDiffusionImg2ImgPipeline.from_pretrained(<span class="hljs-string">"stable-diffusion-v1-5/stable-diffusion-v1-5"</span>) | |
| gr.Interface.from_pipeline(pipe).launch()<!----></pre></div><!----> <p>Varsayılan olarak web demosu yerel bir sunucuda çalışır. Bunu başkalarıyla paylaşmak isterseniz, <code>launch()</code> içinde <code>share=True</code> ayarlayarak geçici bir herkese açık bağlantı oluşturabilirsiniz. Ya da demosunuzu kalıcı bir bağlantı için <a href="https://huggingface.co/spaces" rel="nofollow">Hugging Face Spaces</a><a href="https://huggingface.co/spaces" rel="nofollow">https://huggingface.co/spaces</a> üzerinde barındırabilirsiniz.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/stable_diffusion/overview.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_1rjuniz = { | |
| base: "/docs/diffusers/main/en", | |
| assets: "/docs/diffusers/main/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/diffusers/main/en/_app/immutable/entry/start.vZc-dOUR.js"), | |
| import("/docs/diffusers/main/en/_app/immutable/entry/app.B6c3Ml05.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 247], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 30.1 kB
- Xet hash:
- b12f476a4275b39fb698444ed9874577a9117dd0280e4c22ce3e90691a9aa4e9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.