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