Upload multi.py
Browse files
multi.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
css = src / 'multi.css'
|
| 10 |
+
mark = src / 'marking.py'
|
| 11 |
+
img = src / 'loading.png'
|
| 12 |
+
|
| 13 |
+
A1111 = src / 'A1111.py'
|
| 14 |
+
Forge = src / 'Forge.py'
|
| 15 |
+
ComfyUI = src / 'ComfyUI.py'
|
| 16 |
+
|
| 17 |
+
os.chdir(home)
|
| 18 |
+
src.mkdir(parents=True, exist_ok=True)
|
| 19 |
+
|
| 20 |
+
x = [
|
| 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 dupe_button(desc):
|
| 32 |
+
button = widgets.Button(description=desc)
|
| 33 |
+
button.add_class("buttons")
|
| 34 |
+
return button
|
| 35 |
+
|
| 36 |
+
output = widgets.Output()
|
| 37 |
+
buttons = [dupe_button(desc) for desc in ['A1111', 'Forge', 'ComfyUI']]
|
| 38 |
+
selection_panel = widgets.HBox(buttons, layout=widgets.Layout(
|
| 39 |
+
width='500px',
|
| 40 |
+
height='100%',
|
| 41 |
+
display='flex',
|
| 42 |
+
flex_flow='row',
|
| 43 |
+
align_items='center',
|
| 44 |
+
justify_content='space-between',
|
| 45 |
+
padding='20px'))
|
| 46 |
+
|
| 47 |
+
selection_panel.add_class("main-panel")
|
| 48 |
+
|
| 49 |
+
def load_css(css):
|
| 50 |
+
with css.open("r") as file:
|
| 51 |
+
data = file.read()
|
| 52 |
+
|
| 53 |
+
display(HTML(f"<style>{data}</style>"))
|
| 54 |
+
|
| 55 |
+
def selection(b):
|
| 56 |
+
selection_panel.close()
|
| 57 |
+
clear_output()
|
| 58 |
+
|
| 59 |
+
with output:
|
| 60 |
+
if b.description == 'A1111':
|
| 61 |
+
get_ipython().magic(f'run {A1111}')
|
| 62 |
+
|
| 63 |
+
elif b.description == 'Forge':
|
| 64 |
+
get_ipython().magic(f'run {Forge}')
|
| 65 |
+
|
| 66 |
+
elif b.description == 'ComfyUI':
|
| 67 |
+
get_ipython().magic(f'run {ComfyUI}')
|
| 68 |
+
|
| 69 |
+
load_css(css)
|
| 70 |
+
display(selection_panel, output)
|
| 71 |
+
|
| 72 |
+
for button in buttons:
|
| 73 |
+
button.on_click(selection)
|