Update app.py
Browse files
app.py
CHANGED
@@ -1,63 +1,23 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
import gdown
|
5 |
-
from IPython import get_ipython
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
get_ipython().system('curl -Lo /content/microsoftexcel/embeddings/embeddings.zip https://huggingface.co/nolanaatama/colab/resolve/main/embeddings.zip')
|
20 |
-
get_ipython().system('curl -Lo /content/microsoftexcel/models/ESRGAN/upscalers.zip https://huggingface.co/nolanaatama/colab/resolve/main/upscalers.zip')
|
21 |
-
get_ipython().run_line_magic('cd', '/content/microsoftexcel/extensions')
|
22 |
-
get_ipython().system('unzip /content/microsoftexcel/extensions/microsoftexcel-images-browser.zip')
|
23 |
-
get_ipython().run_line_magic('cd', '/content/microsoftexcel/embeddings')
|
24 |
-
get_ipython().system('unzip /content/microsoftexcel/embeddings/embeddings.zip')
|
25 |
-
get_ipython().run_line_magic('cd', '/content/microsoftexcel/models/ESRGAN')
|
26 |
-
get_ipython().system('unzip /content/microsoftexcel/models/ESRGAN/upscalers.zip')
|
27 |
-
get_ipython().system('rm upscalers.zip')
|
28 |
-
get_ipython().run_line_magic('cd', '/content')
|
29 |
-
# Model Code
|
30 |
-
get_ipython().system('curl -Lo /content/microsoftexcel/models/Stable-diffusion/arcane-diffusion-v3.ckpt https://huggingface.co/nitrosocke/Arcane-Diffusion/resolve/main/arcane-diffusion-v3.ckpt')
|
31 |
-
get_ipython().system('curl -Lo /content/microsoftexcel/models/Stable-diffusion/anything-v3-full.safetensors https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/anything-v3-full.safetensors')
|
32 |
-
gdown.download('https://drive.google.com/uc?id=1vjJDYGdSU6IjTNKOIvNeYQ7t14bQuh7o', '/content/microsoftexcel/models/Stable-diffusion/oshi25v.ckpt')
|
33 |
-
gdown.download('https://drive.google.com/uc?id=1WdxvVSgYPndXglj-9PqOdOJvQICXzGot', '/content/microsoftexcel/models/Stable-diffusion/aot.ckpt')
|
34 |
-
get_ipython().system('curl -Lo /content/microsoftexcel/models/Stable-diffusion/openjourneyv4.ckpt https://huggingface.co/prompthero/openjourney-v4/resolve/main/openjourney-v4.ckpt')
|
35 |
-
# ControlNet
|
36 |
-
# Remove '#' from the beginning of the line(s) below to download the selected ControlNet model(s)
|
37 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11e_sd15_ip2p.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors
|
38 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11e_sd15_shuffle.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors
|
39 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_canny.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_canny_fp16.safetensors
|
40 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11f1p_sd15_depth.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_depth_fp16.safetensors
|
41 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_inpaint.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors
|
42 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_lineart.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_lineart_fp16.safetensors
|
43 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_mlsd.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors
|
44 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_normalbae.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors
|
45 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_openpose.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_openpose_fp16.safetensors
|
46 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_scribble.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_scribble_fp16.safetensors
|
47 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_seg.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_seg_fp16.safetensors
|
48 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15_softedge.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_softedge_fp16.safetensors
|
49 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11p_sd15s2_lineart_anime.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors
|
50 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/control_v11f1e_sd15_tile.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors
|
51 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_canny_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_canny_sd14v1.pth
|
52 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_color_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_color_sd14v1.pth
|
53 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_depth_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_depth_sd14v1.pth
|
54 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_keypose_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_keypose_sd14v1.pth
|
55 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_openpose_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_openpose_sd14v1.pth
|
56 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_seg_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_seg_sd14v1.pth
|
57 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_sketch_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_sketch_sd14v1.pth
|
58 |
-
#!curl -Lo /content/microsoftexcel/extensions/microsoftexcel-controlnet/models/t2iadapter_style_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_style_sd14v1.pth
|
59 |
-
get_ipython().system('rm microsoftexcel.zip')
|
60 |
-
get_ipython().run_line_magic('cd', '/content/microsoftexcel')
|
61 |
-
# Web UI tunnel
|
62 |
-
get_ipython().system('COMMANDLINE_ARGS="--share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension --gradio-queue" REQS_FILE="requirements.txt" python launch.py')
|
63 |
-
# Use this command below to use cloudflare tunnel
|
|
|
1 |
+
from diffusers import AutoencoderKL, UNet2DConditionModel, StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DPMSolverMultistepScheduler
|
2 |
+
import gradio as gr
|
3 |
+
import torch
|
4 |
+
from PIL import Image
|
5 |
+
import utils
|
6 |
+
import datetime
|
7 |
+
import time
|
8 |
+
import psutil
|
9 |
+
import random
|
10 |
|
|
|
|
|
11 |
|
12 |
+
start_time = time.time()
|
13 |
+
is_colab = utils.is_google_colab()
|
14 |
+
state = None
|
15 |
+
current_steps = 25
|
16 |
+
|
17 |
+
class Model:
|
18 |
+
def __init__(self, name, path="", prefix=""):
|
19 |
+
self.name = name
|
20 |
+
self.path = path
|
21 |
+
self.prefix = prefix
|
22 |
+
self.pipe_t2i = None
|
23 |
+
self.pipe_i2i = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|