---
title: 用 Colab 免費體驗 AI 繪圖
author: Willis Chen
disqus: HackMD
image: https://hackmd.io/_uploads/S1SFBNzy2.png
GA: G-CH7FZ71WRC
---
# 用 Colab 免費體驗 AI 繪圖
![](https://hackmd.io/_uploads/S1NNdMMyh.png)
:::danger
注意,由於Colab修改了執行政策不允許以腳本免費跑SD圖,請改為[蔡炎龍老師提的方案](https://colab.research.google.com/github/yenlung/Generative-AI-Book/blob/main/%E5%86%92%E9%9A%AA08b_%E6%89%93%E9%80%A0_Stable_Diffusion_Chilloutmix_Web_APP.ipynb)練習。
:::
## 您也想要自己用AI繪圖嗎?
- 生成式AI ( AIGC ) 是2023年的顯學,開源的 AI 繪圖模型創作越來越多,在[Civitai](https://civitai.com/)有非常多網友創作(需註冊,許多有年齡限制),您也想自己嘗試嗎? 網路上已經有許多自行下載執行 Python 程式與模型,但就需要自備 GPU 顯卡。
- 有網友在此 [GitHub](https://github.com/camenduru/stable-diffusion-webui-colab) 整理諸多 AIGC 模型,而且可以用 Colab 直接產圖, Colab 是個可以免費暫時執行 GPU 運算的虛擬機,可執行 Python 及 Linux指令,您唯一要付出的是等待時間,一起來製作香香的圖吧。
![](https://hackmd.io/_uploads/SJ2JuMGy2.png)
在這個範例,您只要兩個步驟就可以完成囉:
1. 打開以下 [Colab![](https://hackmd.io/_uploads/ryg0Yfzkh.png)](https://colab.research.google.com/drive/15NIShDq3Q7TH8ziwnAlQBFhKLTgqJO0m?usp=sharing) ,一鍵執行以下程式碼,程式跑完會出現3個連結,點選第2個連結會開啟新分頁,是生圖的 UI 介面。
![](https://hackmd.io/_uploads/SkBJbGGy2.png)
2. 在介面新介面的 Text2Img 有兩個文字框,可以輸入以下兩個正向、負向語詞(Prompt),
![](https://hackmd.io/_uploads/Hy5rCbMJ3.png)
- *正面語詞*
```
8k, RAW photo, best quality, masterpiece:1.2), (realistic, photo-realistic:1.4), ultra-detailed, (Kpop idol),perfect detail , looking at viewer,make up,
```
- 負面語詞
```
paintings,sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, bad anatomy,(long hair:1.4),DeepNegative,(fat:1.2),facing away, looking away,tilted head, {Multiple people}, lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worstquality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,
```
- 還可以img2img繼續生圖
![](https://hackmd.io/_uploads/H1V8Jfz1h.png)
細節就請自行探索吧!
## 參考
- https://www.kocpc.com.tw/archives/482754
- https://github.com/camenduru/stable-diffusion-webui-colab
- https://youtu.be/LABwW9gx7C0
- https://colab.research.google.com/github/camenduru/stable-diffusion-webui-colab/blob/main/stable/chillout_mix_webui_colab.ipynb
- https://colab.research.google.com/github/yenlung/Generative-AI-Book/blob/main/%E5%86%92%E9%9A%AA08b_%E6%89%93%E9%80%A0_Stable_Diffusion_Chilloutmix_Web_APP.ipynb