Update multi.py
Browse files
multi.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
from pathlib import Path
|
| 2 |
from IPython.display import display, HTML, clear_output
|
| 3 |
from IPython import get_ipython
|
| 4 |
from ipywidgets import widgets
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
home = Path.home()
|
| 8 |
src = home / '.gutris1'
|
| 9 |
-
|
| 10 |
mark = src / 'marking.py'
|
| 11 |
img = src / 'loading.png'
|
| 12 |
|
|
@@ -14,60 +14,57 @@ A1111 = src / 'A1111.py'
|
|
| 14 |
Forge = src / 'Forge.py'
|
| 15 |
ComfyUI = src / 'ComfyUI.py'
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
f"curl -sLo {css} https://github.com/gutris1/segsmaker/raw/main/script/multi/multi.css",
|
| 22 |
-
f"curl -sLo {img} https://github.com/gutris1/segsmaker/raw/main/script/loading.png",
|
| 23 |
-
f"curl -sLo {mark} https://github.com/gutris1/segsmaker/raw/main/script/multi/marking.py",
|
| 24 |
-
f"curl -sLo {A1111} https://github.com/gutris1/segsmaker/raw/main/script/multi/A1111.py",
|
| 25 |
-
f"curl -sLo {Forge} https://huggingface.co/Carlos2312/asd/resolve/main/Forge.py",
|
| 26 |
-
f"curl -sLo {ComfyUI} https://github.com/gutris1/segsmaker/raw/main/script/multi/ComfyUI.py"]
|
| 27 |
-
|
| 28 |
-
for y in x:
|
| 29 |
-
get_ipython().system(y)
|
| 30 |
|
| 31 |
-
def
|
| 32 |
-
|
| 33 |
-
button.add_class("buttons")
|
| 34 |
-
return button
|
| 35 |
|
| 36 |
-
output
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
align_items='center',
|
| 44 |
-
justify_content='space-between',
|
| 45 |
-
padding='20px'))
|
| 46 |
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
-
load_css(
|
| 70 |
-
display(
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
button.on_click(selection)
|
|
|
|
|
|
|
| 1 |
from IPython.display import display, HTML, clear_output
|
| 2 |
from IPython import get_ipython
|
| 3 |
from ipywidgets import widgets
|
| 4 |
+
from pathlib import Path
|
| 5 |
import os
|
| 6 |
|
| 7 |
home = Path.home()
|
| 8 |
src = home / '.gutris1'
|
| 9 |
+
css_setup = src / 'setup.css'
|
| 10 |
mark = src / 'marking.py'
|
| 11 |
img = src / 'loading.png'
|
| 12 |
|
|
|
|
| 14 |
Forge = src / 'Forge.py'
|
| 15 |
ComfyUI = src / 'ComfyUI.py'
|
| 16 |
|
| 17 |
+
def load_css():
|
| 18 |
+
with open(css_setup, "r") as file:
|
| 19 |
+
data = file.read()
|
| 20 |
|
| 21 |
+
display(HTML(f"<style>{data}</style>"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
def selection(btn):
|
| 24 |
+
multi_panel.close()
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
with output:
|
| 27 |
+
if btn == 'A1111':
|
| 28 |
+
get_ipython().run_line_magic('run', f'{A1111}')
|
| 29 |
+
elif btn == 'Forge':
|
| 30 |
+
get_ipython().run_line_magic('run', f'{Forge}')
|
| 31 |
+
elif btn == 'ComfyUI':
|
| 32 |
+
get_ipython().run_line_magic('run', f'{ComfyUI}')
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
options = ['A1111', 'Forge', 'ComfyUI']
|
| 35 |
+
buttons = []
|
| 36 |
|
| 37 |
+
for btn in options:
|
| 38 |
+
button = widgets.Button(description='')
|
| 39 |
+
button.add_class(btn.lower())
|
| 40 |
+
button.on_click(lambda x, btn=btn: selection(btn))
|
| 41 |
+
buttons.append(button)
|
| 42 |
|
| 43 |
+
output = widgets.Output()
|
| 44 |
|
| 45 |
+
multi_panel = widgets.HBox(
|
| 46 |
+
buttons, layout=widgets.Layout(
|
| 47 |
+
width='600px',
|
| 48 |
+
height='405px'))
|
| 49 |
+
multi_panel.add_class('multi-panel')
|
| 50 |
|
| 51 |
+
def multi_widgets():
|
| 52 |
+
if not src.exists():
|
| 53 |
+
src.mkdir(parents=True, exist_ok=True)
|
| 54 |
|
| 55 |
+
x = [
|
| 56 |
+
f"curl -sLo {css_setup} https://github.com/gutris1/segsmaker/raw/main/script/multi/setup.css",
|
| 57 |
+
f"curl -sLo {img} https://github.com/gutris1/segsmaker/raw/main/script/loading.png",
|
| 58 |
+
f"curl -sLo {mark} https://github.com/gutris1/segsmaker/raw/main/script/multi/marking.py",
|
| 59 |
+
f"curl -sLo {A1111} https://github.com/gutris1/segsmaker/raw/main/script/multi/A1111.py",
|
| 60 |
+
f"curl -sLo {Forge} https://huggingface.co/Carlos2312/asd/resolve/main/Forge.py",
|
| 61 |
+
f"curl -sLo {ComfyUI} https://github.com/gutris1/segsmaker/raw/main/script/multi/ComfyUI.py"]
|
| 62 |
|
| 63 |
+
for y in x:
|
| 64 |
+
get_ipython().system(y)
|
| 65 |
|
| 66 |
+
load_css()
|
| 67 |
+
display(multi_panel, output)
|
| 68 |
+
os.chdir(home)
|
| 69 |
|
| 70 |
+
multi_widgets()
|
|
|