Update setup.py
Browse files
setup.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from IPython.display import display, HTML, clear_output
|
| 2 |
from ipywidgets import widgets, Layout
|
| 3 |
from IPython import get_ipython
|
| 4 |
from pathlib import Path
|
|
@@ -6,13 +6,18 @@ import subprocess, time, os, shlex
|
|
| 6 |
from nenen88 import pull, say, download, clone, tempe
|
| 7 |
|
| 8 |
version = "v1.9.4"
|
| 9 |
-
|
| 10 |
-
zzz = Path(xxx) / "asd"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
if git_dir.exists():
|
| 15 |
-
os.chdir(
|
| 16 |
commit_hash = os.popen('git rev-parse HEAD').read().strip()
|
| 17 |
|
| 18 |
if commit_hash != version:
|
|
@@ -20,140 +25,132 @@ if zzz.exists():
|
|
| 20 |
get_ipython().system("git fetch --tags")
|
| 21 |
|
| 22 |
else:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
get_ipython().system(f"
|
| 27 |
-
get_ipython().system(f"curl -sLo {mama} https://github.com/gutris1/segsmaker/raw/main/ui/sd/asd/setup.css")
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
ikuuuhhh = widgets.Button(description='Install')
|
| 33 |
|
| 34 |
-
|
| 35 |
sd_setup = widgets.Output()
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
selected = [None]
|
| 49 |
|
| 50 |
-
def
|
| 51 |
-
with open(
|
| 52 |
-
|
| 53 |
|
| 54 |
-
display(HTML(f"<style>{
|
| 55 |
|
| 56 |
-
def req_list(
|
| 57 |
return [
|
| 58 |
-
f"
|
| 59 |
-
f"
|
| 60 |
-
f"mkdir -p {
|
| 61 |
-
f"
|
| 62 |
-
f"ln -vs /tmp {
|
| 63 |
-
f"ln -vs /tmp/
|
| 64 |
-
f"ln -vs /tmp/
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
def sd_clone(xxx, zzz, fff):
|
| 69 |
time.sleep(1)
|
| 70 |
-
pull(f"https://github.com/gutris1/segsmaker sd {
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
os.chdir(zzz)
|
| 73 |
-
req = req_list(xxx, zzz)
|
| 74 |
for lines in req:
|
| 75 |
-
subprocess.run(shlex.split(lines), **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
-
def sd_1_5(
|
| 78 |
-
sd_clone(
|
| 79 |
|
| 80 |
extras = [
|
| 81 |
-
f"https://
|
| 82 |
-
f"https://
|
| 83 |
-
f"https://huggingface.co/
|
| 84 |
-
f"https://huggingface.co/
|
| 85 |
-
f"https://huggingface.co/
|
| 86 |
-
|
| 87 |
-
f"https://huggingface.co/pantat88/ui/resolve/main/4x_foolhardy_Remacri.pth {zzz}/models/ESRGAN",
|
| 88 |
-
f"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors {zzz}/models/VAE",
|
| 89 |
-
f"https://github.com/gutris1/segsmaker/raw/main/script/zrok_reg.py {zzz}/asd",
|
| 90 |
-
f"https://huggingface.co/Carlos2312/asd/resolve/main/modelos.py {zzz}/asd",
|
| 91 |
-
f"https://huggingface.co/Carlos2312/asd/resolve/main/ext-1_5.txt {zzz}/asd",
|
| 92 |
-
f"https://github.com/gutris1/segsmaker/raw/main/script/zrok.py {zzz}",
|
| 93 |
-
f"https://github.com/gutris1/segsmaker/raw/main/script/pinggy.py {zzz}"
|
| 94 |
-
]
|
| 95 |
-
|
| 96 |
for items in extras:
|
| 97 |
download(items)
|
| 98 |
-
|
| 99 |
-
#add
|
| 100 |
|
| 101 |
-
|
| 102 |
-
os.chdir(
|
| 103 |
-
clone(
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
get_ipython().system(f"rm -rf {zzz}/embeddings")
|
| 110 |
-
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/emb {zzz}/embeddings")
|
| 111 |
|
| 112 |
-
get_ipython().system(f"rm -rf {
|
| 113 |
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/lrs {zzz}/models/Lora")
|
| 114 |
|
| 115 |
-
get_ipython().system(f"rm -rf {
|
| 116 |
-
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/md {
|
| 117 |
-
|
| 118 |
-
get_ipython().system(f"rm -rf {zzz}/extensions/sd-dynamic-prompts/wildcards")
|
| 119 |
-
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/Wilcards {zzz}/extensions/sd-dynamic-prompts/wildcards")
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
get_ipython().system(f"curl -sLo {z} {url}")
|
| 129 |
-
get_ipython().system(f"tar -xzf {z} -C {zrok} --wildcards *zrok")
|
| 130 |
-
get_ipython().system(f"rm -rf {xxx}/.cache/* {z}")
|
| 131 |
-
|
| 132 |
-
def sd_install(selection):
|
| 133 |
-
with garis:
|
| 134 |
-
display(HTML(gariz))
|
| 135 |
|
| 136 |
with sd_setup:
|
| 137 |
sd_setup.clear_output()
|
| 138 |
-
os.chdir(xxx)
|
| 139 |
say("<b>γ{red} Installing Stable Diffusion{d} γ{red}</b>")
|
| 140 |
-
get_ipython().system(f"
|
| 141 |
|
| 142 |
-
|
|
|
|
| 143 |
|
| 144 |
-
with
|
| 145 |
-
|
| 146 |
|
| 147 |
say("<br><b>γ{red} Done{d} γ{red}</b>")
|
| 148 |
|
| 149 |
-
def
|
| 150 |
selected[0] = button.description
|
| 151 |
|
| 152 |
-
def
|
| 153 |
selection = selected[0]
|
| 154 |
|
| 155 |
if selection:
|
| 156 |
-
widgets.Widget.close(
|
| 157 |
sd_setup.clear_output()
|
| 158 |
sd_install(selection)
|
| 159 |
|
|
@@ -163,10 +160,9 @@ else:
|
|
| 163 |
print("ε°γͺγγ¨γιΈζγγ¦γγ")
|
| 164 |
return
|
| 165 |
|
| 166 |
-
|
| 167 |
-
|
| 168 |
|
| 169 |
-
|
| 170 |
-
display(
|
| 171 |
-
|
| 172 |
-
tempe()
|
|
|
|
| 1 |
+
from IPython.display import display, HTML, clear_output, Image
|
| 2 |
from ipywidgets import widgets, Layout
|
| 3 |
from IPython import get_ipython
|
| 4 |
from pathlib import Path
|
|
|
|
| 6 |
from nenen88 import pull, say, download, clone, tempe
|
| 7 |
|
| 8 |
version = "v1.9.4"
|
| 9 |
+
repo = f"git clone -q -b {version} https://github.com/gutris1/asd"
|
|
|
|
| 10 |
|
| 11 |
+
home = Path.home()
|
| 12 |
+
webui = home / "asd"
|
| 13 |
+
img = home / ".conda/loading.png"
|
| 14 |
+
|
| 15 |
+
os.chdir(home)
|
| 16 |
+
|
| 17 |
+
if webui.exists():
|
| 18 |
+
git_dir = webui / '.git'
|
| 19 |
if git_dir.exists():
|
| 20 |
+
os.chdir(webui)
|
| 21 |
commit_hash = os.popen('git rev-parse HEAD').read().strip()
|
| 22 |
|
| 23 |
if commit_hash != version:
|
|
|
|
| 25 |
get_ipython().system("git fetch --tags")
|
| 26 |
|
| 27 |
else:
|
| 28 |
+
css = home / ".conda/setup.css"
|
| 29 |
+
devnull = {"stdout": subprocess.DEVNULL, "stderr": subprocess.DEVNULL}
|
| 30 |
|
| 31 |
+
get_ipython().system(f"curl -sLo {css} https://github.com/gutris1/segsmaker/raw/main/ui/sd/asd/setup.css")
|
|
|
|
| 32 |
|
| 33 |
+
loading = widgets.Output()
|
| 34 |
+
button1 = widgets.Button(description='SD 1.5')
|
| 35 |
+
install_button = widgets.Button(description='Install')
|
|
|
|
| 36 |
|
| 37 |
+
button_button = widgets.HBox([button1], layout=Layout(justify_content='space-between'))
|
| 38 |
sd_setup = widgets.Output()
|
| 39 |
+
panel = widgets.VBox([button_button, install_button],
|
| 40 |
+
layout=Layout(
|
| 41 |
+
width='400px',
|
| 42 |
+
height='150px',
|
| 43 |
+
display='flex',
|
| 44 |
+
flex_flow='column',
|
| 45 |
+
align_items='center',
|
| 46 |
+
justify_content='space-between',
|
| 47 |
+
padding='20px'))
|
| 48 |
+
button1.add_class("b1")
|
| 49 |
+
install_button.add_class("out")
|
| 50 |
+
panel.add_class("boxxx")
|
| 51 |
selected = [None]
|
| 52 |
|
| 53 |
+
def load_css(css):
|
| 54 |
+
with css.open("r") as file:
|
| 55 |
+
ccs = file.read()
|
| 56 |
|
| 57 |
+
display(HTML(f"<style>{ccs}</style>"))
|
| 58 |
|
| 59 |
+
def req_list(home, webui):
|
| 60 |
return [
|
| 61 |
+
f"rm -rf {home}/tmp/* {home}/tmp {webui}/models/Stable-diffusion/tmp_ckpt {webui}/models/Lora/tmp_lora {webui}/models/ControlNet",
|
| 62 |
+
f"mkdir -p {webui}/models/Lora",
|
| 63 |
+
f"mkdir -p {webui}/models/ESRGAN",
|
| 64 |
+
f"ln -vs /tmp {home}/tmp",
|
| 65 |
+
f"ln -vs /tmp/ckpt {webui}/models/Stable-diffusion/tmp_ckpt",
|
| 66 |
+
f"ln -vs /tmp/lora {webui}/models/Lora/tmp_lora",
|
| 67 |
+
f"ln -vs /tmp/controlnet {webui}/models/ControlNet"]
|
| 68 |
+
|
| 69 |
+
def sd_clone(home, webui, devnull):
|
|
|
|
|
|
|
| 70 |
time.sleep(1)
|
| 71 |
+
pull(f"https://github.com/gutris1/segsmaker sd {webui}")
|
| 72 |
+
|
| 73 |
+
os.chdir(webui)
|
| 74 |
+
req = req_list(home, webui)
|
| 75 |
|
|
|
|
|
|
|
| 76 |
for lines in req:
|
| 77 |
+
subprocess.run(shlex.split(lines), **devnull)
|
| 78 |
+
|
| 79 |
+
scripts = [
|
| 80 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/zrok_reg.py {webui}/asd",
|
| 81 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/zrok.py {webui}",
|
| 82 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/pinggy.py {webui}",
|
| 83 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/ngrok.py {webui}",
|
| 84 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/venv.py {webui}"]
|
| 85 |
+
|
| 86 |
+
upscalers = [
|
| 87 |
+
f"https://huggingface.co/pantat88/ui/resolve/main/4x-UltraSharp.pth {webui}/models/ESRGAN",
|
| 88 |
+
f"https://huggingface.co/pantat88/ui/resolve/main/4x-AnimeSharp.pth {webui}/models/ESRGAN",
|
| 89 |
+
f"https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth {webui}/models/ESRGAN",
|
| 90 |
+
f"https://huggingface.co/pantat88/ui/resolve/main/4x_RealisticRescaler_100000_G.pth {webui}/models/ESRGAN",
|
| 91 |
+
f"https://huggingface.co/pantat88/ui/resolve/main/8x_RealESRGAN.pth {webui}/models/ESRGAN",
|
| 92 |
+
f"https://huggingface.co/pantat88/ui/resolve/main/4x_foolhardy_Remacri.pth {webui}/models/ESRGAN"]
|
| 93 |
+
|
| 94 |
+
line = scripts + upscalers
|
| 95 |
+
for item in line:
|
| 96 |
+
download(item)
|
| 97 |
|
| 98 |
+
def sd_1_5(home, webui, devnull):
|
| 99 |
+
sd_clone(home, webui, devnull)
|
| 100 |
|
| 101 |
extras = [
|
| 102 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/controlnet/cn-1_5.css {webui}/asd",
|
| 103 |
+
f"https://github.com/gutris1/segsmaker/raw/main/script/controlnet/cn-1_5.py {webui}/asd",
|
| 104 |
+
f"https://huggingface.co/Carlos2312/asd/resolve/main/modelos.py {webui}/asd",
|
| 105 |
+
f"https://huggingface.co/Carlos2312/asd/resolve/main/ext-1_5.txt {webui}/asd",
|
| 106 |
+
f"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors {webui}/models/VAE"]
|
| 107 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
for items in extras:
|
| 109 |
download(items)
|
|
|
|
|
|
|
| 110 |
|
| 111 |
+
say("<br><b>γ{red} Installing Extensions{d} γ{red}</b>")
|
| 112 |
+
os.chdir(webui / "extensions")
|
| 113 |
+
clone(str(webui / "asd/ext-1_5.txt"))
|
| 114 |
+
os.rename(str(webui / "asd/cn-1_5.py"), str(webui / "asd/controlnet.py"))
|
| 115 |
+
|
| 116 |
+
get_ipython().system(f"rm -rf {webui}/embeddings")
|
| 117 |
+
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/emb {webui}/embeddings")
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
+
get_ipython().system(f"rm -rf {webui}/models/Lora")
|
| 120 |
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/lrs {zzz}/models/Lora")
|
| 121 |
|
| 122 |
+
get_ipython().system(f"rm -rf {webui}/models/adetailer")
|
| 123 |
+
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/md {webui}/models/adetailer")
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
+
get_ipython().system(f"rm -rf {webui}/extensions/sd-dynamic-prompts/wildcards")
|
| 126 |
+
get_ipython().system(f"git clone https://huggingface.co/Carlos2312/Wilcards {webui}/extensions/sd-dynamic-prompts/wildcards")
|
| 127 |
+
|
| 128 |
+
def sd_install(selection):
|
| 129 |
+
with loading:
|
| 130 |
+
clear_output()
|
| 131 |
+
display(Image(filename=str(img)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
with sd_setup:
|
| 134 |
sd_setup.clear_output()
|
|
|
|
| 135 |
say("<b>γ{red} Installing Stable Diffusion{d} γ{red}</b>")
|
| 136 |
+
get_ipython().system(f"{repo}")
|
| 137 |
|
| 138 |
+
if selection == 'SD 1.5':
|
| 139 |
+
sd_1_5(home, webui, devnull)
|
| 140 |
|
| 141 |
+
with loading:
|
| 142 |
+
loading.clear_output()
|
| 143 |
|
| 144 |
say("<br><b>γ{red} Done{d} γ{red}</b>")
|
| 145 |
|
| 146 |
+
def button_panel(button):
|
| 147 |
selected[0] = button.description
|
| 148 |
|
| 149 |
+
def installing(button):
|
| 150 |
selection = selected[0]
|
| 151 |
|
| 152 |
if selection:
|
| 153 |
+
widgets.Widget.close(panel)
|
| 154 |
sd_setup.clear_output()
|
| 155 |
sd_install(selection)
|
| 156 |
|
|
|
|
| 160 |
print("ε°γͺγγ¨γιΈζγγ¦γγ")
|
| 161 |
return
|
| 162 |
|
| 163 |
+
button1.on_click(button_panel)
|
| 164 |
+
install_button.on_click(installing)
|
| 165 |
|
| 166 |
+
load_css(css)
|
| 167 |
+
display(panel, sd_setup, loading)
|
| 168 |
+
tempe()
|
|
|