Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""Copy of Notebook.ipynb
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colaboratory.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1GtmzITCs5RRtzqmzOPZgne3hrx1d_CeI
|
| 8 |
+
|
| 9 |
+
Adapted from: https://colab.research.google.com/drive/1AfAmwLMd_Vx33O9IwY2TmO9wKZ8ABRRa
|
| 10 |
+
|
| 11 |
+
Adapted again from: https://colab.research.google.com/drive/1Iy-xW9t1-OQWhb0hNxueGij8phCyluOh
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
!nvidia-smi
|
| 15 |
+
|
| 16 |
+
import os
|
| 17 |
+
os.kill(os.getpid(), 9) # This will crash Colab (required, everything will still be intact so dont worry)
|
| 18 |
+
|
| 19 |
+
"""Clone webui repository"""
|
| 20 |
+
|
| 21 |
+
# Commented out IPython magic to ensure Python compatibility.
|
| 22 |
+
!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /content/stable-diffusion-webui
|
| 23 |
+
# %cd /content/stable-diffusion-webui
|
| 24 |
+
|
| 25 |
+
"""Download the model from huggingface.
|
| 26 |
+
Leave the model name and link as default, unless you know what you are doing
|
| 27 |
+
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
#@title 1.3 Model
|
| 31 |
+
model_name = "wd-v1-3-float16.ckpt" #@param {type:"string"}
|
| 32 |
+
model_link = "https://huggingface.co/hakurei/waifu-diffusion-v1-3/resolve/main/wd-v1-3-float16.ckpt" #@param {type:"string"}
|
| 33 |
+
!wget {model_link} -O models/Stable-diffusion/{model_name}
|
| 34 |
+
|
| 35 |
+
"""Install requirements, download repositories of stable diffusion"""
|
| 36 |
+
|
| 37 |
+
!COMMANDLINE_ARGS="--exit" REQS_FILE="requirements.txt" python launch.py
|
| 38 |
+
|
| 39 |
+
"""Kill the runtime."""
|
| 40 |
+
|
| 41 |
+
import os
|
| 42 |
+
os.kill(os.getpid(), 9) # This will crash Colab (required, everything will still be intact so dont worry)
|
| 43 |
+
|
| 44 |
+
"""Change into Web UI directory and download updates"""
|
| 45 |
+
|
| 46 |
+
# Commented out IPython magic to ensure Python compatibility.
|
| 47 |
+
# %cd /content/stable-diffusion-webui
|
| 48 |
+
!git pull
|
| 49 |
+
|
| 50 |
+
"""Launch web ui. Once it finishes launching, you will see `Running on public URL: xxxx.gradio.app`
|
| 51 |
+
|
| 52 |
+
PLEASE WAIT 10 SECONDS BEFORE CLICKING THE LINK IN ORDER FOR EVERYTHING TO LOAD
|
| 53 |
+
|
| 54 |
+
Click that link, and you are now using WD 1.3!
|
| 55 |
+
|
| 56 |
+
Commandline arguments are:
|
| 57 |
+
- `--share` - create online gradio.app link
|
| 58 |
+
- `--gradio-debug` - print outputs to console
|
| 59 |
+
- optional: `--gradio-auth me:qwerty` - add authentication to gradio: username me, password qwerty
|
| 60 |
+
- see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Run-with-Custom-Parameters) for more options
|
| 61 |
+
"""
|
| 62 |
+
|
| 63 |
+
!COMMANDLINE_ARGS="--share --gradio-debug" REQS_FILE="requirements.txt" python launch.py
|