# Stable Diffusion 사용하기

<figure><img src="/files/DLv8UBU3yRWMNXfU42Ay" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %} <mark style="color:red;">**Stable Diffusion**</mark><mark style="color:red;">이란?</mark>

딥러닝 기술을 기반으로 한 이미지 생성 모델입니다. \
주어진 프롬프트와 설정에 따라 다양한 이미지를 생성할 수 있습니다.
{% endhint %}

**Stable Diffusion을 이용하면?**

✔️현실과 구분하기 어려운 고품질 이미지 생성

✔️실제 이미지를 기반으로 새로운 이미지 생성

✔️상상력을 발휘하여 새로운 이미지 생성

**Runyour AI가 제공하는&#x20;**<mark style="background-color:yellow;">**템플릿 기능**</mark>**을 통해 Stable Diffusion 을 지금 바로 이용해보세요!**

***

## Step 1. 머신 대여 및 템플릿 선택

<figure><img src="/files/A2tfKtnjSHE0Q6dkJ8Wa" alt=""><figcaption></figcaption></figure>

* GPU Cloud 목록에서 원하는 머신 선택하면 템플릿 선택 단계로 이동합니다.\
  &#x20; <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Stable diffusion**</mark> 템플릿을 선택하고 상단의 대여 버튼을 클릭합니다.
* 대여한 머신은  <mark style="background-color:yellow;">마이페이지>대시보드</mark>에서 확인할 수 있습니다.

## Step 2. WebUI 접속

<figure><img src="/files/MsjnavcLugv27oJhuglC" alt=""><figcaption></figcaption></figure>

* 대여한 머신을 클릭하면, SSH / Web UI 접속 기능과  PEM 키 다운로드 기능을 확인할 수 있습니다.

<figure><img src="/files/6LQBgrs3hKGlSLn6bOxZ" alt=""><figcaption></figcaption></figure>

* 두 가지의 버튼 중 SSH / WEB 버튼을 클릭합니다.

<figure><img src="/files/3KVqm9UGPmPilzthjGzJ" alt=""><figcaption></figcaption></figure>

* 두 가지의 접속 방법 중, 'HTTP' > 'Stable Diffusion Web' 버튼을 클릭해 Web UI에 직접 접속합니다.

<figure><img src="/files/jNtyGNpAZiEk5G4r5tAT" alt=""><figcaption><p>Stable diffusion Web UI 화면</p></figcaption></figure>

{% hint style="info" %}
*SSH 접속은*[ *'SSH 활용하여 원격접속하기'*](/userguide/tutorial/ssh.md)*를 참고해주세요.*
{% endhint %}

* 접속 방법은 사용자의 OS에 따라 구분되며, 아래 참고하여 접속하실 수 있습니다.

> 1\) <mark style="color:red;">**Mac OS**</mark>의 경우, **Terminal**을 실행합니다.
>
> 2\) <mark style="color:red;">**Window OS**</mark>의 경우,  **CMD, Powershell 혹은 기타 터미널 프로그램**을 실행합니다.

## Step 3. Stable Diffusion WebUI 실행

### 'txt2img' 기능 활용하기&#x20;

대표적인 기능 'txt2img'를 활용해 이미지를 생성해보겠습니다.

<figure><img src="/files/DdSLNDXI7RbghI2HIdni" alt=""><figcaption></figcaption></figure>

#### <mark style="color:red;">1) Prompt에는 그림 생성을 위한 지시 내용을 넣어주세요.</mark>

stable-diffusion-webui의 경우 해당 머신에서 7860 포트로 실행됩니다.

```
Prompt 예시

A magical forest with glowing trees, ethereal creatures, sparkling fairy lights, and a misty atmosphere.
```

#### <mark style="color:red;">2) Negative prompt에는 그림에 제외되어야 할 요소를 적어주세요.</mark>

<pre><code>Negative prompt 예시
<strong>Modern buildings, cars, dark shadows, blurry details, dull colors.
</strong></code></pre>

\ <mark style="color:red;">**3) 아래 Generation에서 세부 설정을 확인하고 우측 상단 Generate 버튼을 눌러 그림을 생성합니다.**</mark>

<figure><img src="/files/WqMJ9OACofoKGqp304Pu" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://runyourai.gitbook.io/userguide/tutorial/sd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
