# Stable-diffusion

HamoniKR 7.0 KumKang 버전에는 AI 시대에 흐름에 동참하기 위해 인공 지능을 활용하여 사용자가 제공한 텍스트 설명에 기반한 이미지를 자유롭게 생성할 수 있는 **Stable Diffusion** 애플리케이션을 제공합니다.&#x20;

#### Stable Diffusion이란.

이 Stable Diffusion 모델은 Deep Learning의 분야 중 하나인 Generative Adversarial Network (GAN) 또는 변형된 버전을 사용하여 작동합니다. "Diffusion"이라는 용어는 이 모델이 이미지를 생성하는 방법에 관련이 있으며, 데이터의 확산과 재구성 과정을 통해 이미지를 창출합니다.

이 기술은 다양한 응용 분야에 사용될 수 있으며, 예술 창작부터 제품 디자인, 게임 개발, 영화 제작에 이르기까지 다양한 분야에서 창의적인 이미지를 생성하는 데 사용됩니다.

Stable Diffusion은 특히 다음과 같은 특징을 가지고 있습니다:

1. **텍스트로부터 이미지 생성**: 사용자가 입력한 텍스트 설명에 기반하여 이미지를 생성합니다.
2. **사용자 정의 가능성**: 생성하고자 하는 이미지의 스타일, 콘텐츠, 색상 등을 사용자가 정의할 수 있습니다.
3. **고품질 결과물**: 모델은 고해상도의 세밀한 이미지를 생성할 수 있습니다.
4. **다양한 변형**: 기존 이미지에 스타일을 적용하거나, 이미지의 일부를 수정하는 등의 작업이 가능합니다.

{% embed url="<https://github.com/hamonikr/stable-diffusion-webui>" %}

### Stable-Diffusion 설치하기.

먼저 자신이 사용하고잇는 그래픽 드라이버를 확인해야합니다.&#x20;

Albert (alt + space) > "하드웨어 정보" 애플리케이션으로 확인하는 방법.

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

터미널 명령어로 확인하는 방법.

```
$ lshw -C display 
```

자신이 사용하는 그래픽 종류를 확인하신 후 자신의 그래픽에 맞는 패키지를 설치합니다.&#x20;

```
# Stable-diffusion은 Python 3.10이 설치 되어 있어야 합니다. 
# 만약 Python 3.10버전이 설치 안되어 있다면 설치후 진행해주세요.
$ sudo apt install -y python3.10 python3.10-venv


# 그래픽 카드 AMD 사용자인경우
$ sudo apt-get install stable-diffusion-webui-amd

# 그래픽 카드 Intel 사용자인 경우
$ stable-diffusion-webui-intel

# 그래픽 카드 Nvidia 사용자인 경우
$ stable-diffusion-webui-nvidia


```

### Stable-diffusion 실행하기

1. Albert (alt + space)  또는 프로그램 메뉴에서  "스테이블 디퓨전 Web UI" 실행합니다.&#x20;

<figure><img src="/files/8fS6bzzxwafnhGDD7FAb" alt=""><figcaption></figcaption></figure>

2. 먼저 터미널 창이 실행되면서 Stable-diffusion 실행을 위한 환경 설정 및 설치가 진행됩니다.&#x20;

<figure><img src="/files/1j9BIHxXzmbdij3YadOc" alt=""><figcaption></figcaption></figure>

3. 진행이 완료되면 웹 브라우저가 실행되면서 Stable-diffusion을 사용하실 수 있습니다.&#x20;

<figure><img src="/files/5obueV6i014tgpyunVI6" alt=""><figcaption></figcaption></figure>

### Stable-Diffusion  사용하기.

#### 텍스트로부터 이미지를 생성.

Stable-diffusion 웹 페이지에서  "txt2img"를 선택하고 "prompt"창에 원하시는 이미지를 텍스트로 적고 "Generate" 버튼을 클릭하면 원하시는 이미지가 생성됩니다.&#x20;

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

Stable-diffusion (스테이블 디퓨전) 인터페이스&#x20;

<figure><img src="/files/2Bs5KSpJ5IM099HnY39I" alt=""><figcaption></figcaption></figure>

1. Stable Diffusion checkpoint : 스테이블 디퓨전 학습 모델을 선택할 수 있습니다.
   * 스테이블 디퓨전 모델 추가하는 방법 ( url 추가. )
2. Prompt : 만들고 싶은 이미지의 내용을 입력.
3. Negative prompt : 제외하고자 하는 내용을 입력.
4. Sampling Method :&#x20;
   1. 이미지에서 노이즈를 제거하는 과정을 의미
   2. 스테이블 디퓨전이 이미지를 그릴 때 사용할 샘플링 타입을 선택하는 것.
5. Sampling Steps: 수치를 높게 설정할 수록 노이즈를 추정하고 제거하는 단계가 많아지므로 더 선명하고 디테일한 이미지를 생성할 수 있음.
6. Width : 이미지 넓이&#x20;
7. Height: 이미지 높이
8. Batch count : 수치에 따라 이미지 생성.
9. seed : seed 수치별로 다양한 이미지를 생성.
10. Generate : 이미지 생성 버튼


---

# 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://docs.hamonikr.org/hamonikr-7.0/ai/stable-diffusion.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.
