mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
Merge branch 'kanvas' into dev
This commit is contained in:
Symlink
+1
@@ -0,0 +1 @@
|
||||
/home/vlado/dev/kanvas
|
||||
Submodule extensions-builtin/sdnext-modernui updated: 5bf81ed7fa...eea48d6a2e
+12
-1
@@ -1452,7 +1452,18 @@ def get_version(force=False):
|
||||
version['ui'] = branch_ui
|
||||
except Exception:
|
||||
version['ui'] = 'unknown'
|
||||
os.chdir(cwd)
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
try:
|
||||
os.chdir('extensions-builtin/sdnext-kanvas')
|
||||
res = subprocess.run('git rev-parse --abbrev-ref HEAD', stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell=True, check=True)
|
||||
branch_kanvas = res.stdout.decode(encoding = 'utf8', errors='ignore') if len(res.stdout) > 0 else ''
|
||||
branch_kanvas = 'dev' if 'dev' in branch_kanvas else 'main'
|
||||
version['kanvas'] = branch_kanvas
|
||||
except Exception:
|
||||
version['kanvas'] = 'unknown'
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
ts('version', t_start)
|
||||
return version
|
||||
|
||||
|
||||
+3
-10
@@ -187,10 +187,6 @@ def create_ui(_blocks: gr.Blocks=None):
|
||||
with gr.Tab('Image', id='in-image') as tab_image:
|
||||
input_image = gr.Image(label="Input", show_label=False, type="pil", interactive=True, tool="editor", height=gr_height, image_mode='RGB', elem_id='control_input_select', elem_classes=['control-image'])
|
||||
btn_interrogate = ui_sections.create_interrogate_button('control', what='input')
|
||||
with gr.Tab('Inpaint', id='in-inpaint') as _tab_inpaint:
|
||||
input_inpaint = gr.Image(label="Input", show_label=False, type="pil", interactive=True, tool="sketch", height=gr_height, image_mode='RGB', elem_id='control_input_inpaint', brush_radius=32, mask_opacity=0.6, elem_classes=['control-image'])
|
||||
with gr.Tab('Outpaint', id='in-outpaint') as _tab_outpaint:
|
||||
input_resize = gr.Image(label="Input", show_label=False, type="pil", interactive=True, tool="select", height=gr_height, image_mode='RGB', elem_id='control_input_resize', elem_classes=['control-image'])
|
||||
with gr.Tab('Video', id='in-video') as tab_video:
|
||||
input_video = gr.Video(label="Input", show_label=False, interactive=True, height=gr_height, elem_classes=['control-image'])
|
||||
with gr.Tab('Batch', id='in-batch') as tab_batch:
|
||||
@@ -251,7 +247,7 @@ def create_ui(_blocks: gr.Blocks=None):
|
||||
select_dict = dict(
|
||||
fn=helpers.select_input,
|
||||
_js="controlInputMode",
|
||||
inputs=[input_mode, input_image, init_image, input_type, input_resize, input_inpaint, input_video, input_batch, input_folder],
|
||||
inputs=[input_mode, input_image, init_image, input_type, input_video, input_batch, input_folder],
|
||||
outputs=[output_tabs, preview_process, result_txt, width_before, height_before],
|
||||
show_progress=False,
|
||||
queue=False,
|
||||
@@ -260,14 +256,11 @@ def create_ui(_blocks: gr.Blocks=None):
|
||||
prompt.submit(**select_dict)
|
||||
negative.submit(**select_dict)
|
||||
btn_generate.click(**select_dict)
|
||||
for ctrl in [input_image, input_resize, input_video, input_batch, input_folder, init_image, init_video, init_batch, init_folder, tab_image, tab_video, tab_batch, tab_folder, tab_image_init, tab_video_init, tab_batch_init, tab_folder_init]:
|
||||
for ctrl in [input_image, input_video, input_batch, input_folder, init_image, init_video, init_batch, init_folder, tab_image, tab_video, tab_batch, tab_folder, tab_image_init, tab_video_init, tab_batch_init, tab_folder_init]:
|
||||
if hasattr(ctrl, 'change'):
|
||||
ctrl.change(**select_dict)
|
||||
if hasattr(ctrl, 'clear'):
|
||||
ctrl.clear(**select_dict)
|
||||
for ctrl in [input_inpaint]: # gradio image mode inpaint triggeres endless loop on change event
|
||||
if hasattr(ctrl, 'upload'):
|
||||
ctrl.upload(**select_dict)
|
||||
|
||||
tabs_state = gr.Textbox(value='none', visible=False)
|
||||
input_fields = [
|
||||
@@ -410,7 +403,7 @@ def create_ui(_blocks: gr.Blocks=None):
|
||||
generation_parameters_copypaste.add_paste_fields("control", input_image, paste_fields, override_settings)
|
||||
bindings = generation_parameters_copypaste.ParamBinding(paste_button=btn_paste, tabname="control", source_text_component=prompt, source_image_component=output_gallery)
|
||||
generation_parameters_copypaste.register_paste_params_button(bindings)
|
||||
masking.bind_controls([input_image, input_inpaint, input_resize], preview_process, output_image)
|
||||
masking.bind_controls([input_image], preview_process, output_image)
|
||||
|
||||
if os.environ.get('SD_CONTROL_DEBUG', None) is not None: # debug only
|
||||
from modules.control.test import test_processors, test_controlnets, test_adapters, test_xs, test_lite
|
||||
|
||||
@@ -74,15 +74,12 @@ def get_video(filepath: str):
|
||||
return msg
|
||||
|
||||
|
||||
def select_input(input_mode, input_image, init_image, init_type, input_resize, input_inpaint, input_video, input_batch, input_folder):
|
||||
def select_input(input_mode, input_image, init_image, init_type, input_video, input_batch, input_folder):
|
||||
global busy, input_source, input_init, input_mask # pylint: disable=global-statement
|
||||
busy = True
|
||||
if input_mode == 'Image':
|
||||
selected_input = input_image
|
||||
if input_mode == 'Kanvas':
|
||||
selected_input = input_image
|
||||
elif input_mode == 'Outpaint':
|
||||
selected_input = input_resize
|
||||
elif input_mode == 'Inpaint':
|
||||
selected_input = input_inpaint
|
||||
elif input_mode == 'Video':
|
||||
selected_input = input_video
|
||||
elif input_mode == 'Batch':
|
||||
|
||||
@@ -11,7 +11,7 @@ from modules import extensions, shared, paths, errors, ui_symbols, call_queue
|
||||
debug = shared.log.debug if os.environ.get('SD_EXT_DEBUG', None) is not None else lambda *args, **kwargs: None
|
||||
extensions_index = "https://vladmandic.github.io/sd-data/pages/extensions.json"
|
||||
hide_tags = ["localization"]
|
||||
exclude_extensions = ['sdnext-modernui']
|
||||
exclude_extensions = ['sdnext-modernui', 'sdnext-kanvas']
|
||||
extensions_list = []
|
||||
sort_ordering = {
|
||||
"default": (True, lambda x: x.get('sort_default', '')),
|
||||
|
||||
@@ -20,12 +20,18 @@ def html_head():
|
||||
skip = ['login.js']
|
||||
for js in main:
|
||||
script_js = os.path.join(script_path, "javascript", js)
|
||||
head += f'<script type="text/javascript" src="{webpath(script_js)}"></script>\n'
|
||||
if '.esm' in js or '.mjs' in js:
|
||||
head += f'<script type="module" src="{webpath(script_js)}"></script>\n'
|
||||
else:
|
||||
head += f'<script type="text/javascript" src="{webpath(script_js)}"></script>\n'
|
||||
added = []
|
||||
for script in modules.scripts_manager.list_scripts("javascript", ".js"):
|
||||
if script.filename in main or script.filename in skip:
|
||||
continue
|
||||
head += f'<script type="text/javascript" src="{webpath(script.path)}"></script>\n'
|
||||
if '.esm' in js or '.mjs' in js:
|
||||
head += f'<script type="module" src="{webpath(script.path)}"></script>\n'
|
||||
else:
|
||||
head += f'<script type="text/javascript" src="{webpath(script.path)}"></script>\n'
|
||||
added.append(script.path)
|
||||
for script in modules.scripts_manager.list_scripts("javascript", ".mjs"):
|
||||
head += f'<script type="module" src="{webpath(script.path)}"></script>\n'
|
||||
@@ -96,8 +102,8 @@ def reload_javascript():
|
||||
|
||||
css_base = theme.reload_gradio_theme()
|
||||
css_timesheet = "timesheet.css"
|
||||
|
||||
css = html_css([css_base, css_timesheet])
|
||||
css_kanvas = "kanvas.css"
|
||||
css = html_css([css_base, css_timesheet, css_kanvas])
|
||||
body = html_body()
|
||||
|
||||
def template_response(*args, **kwargs):
|
||||
@@ -111,8 +117,6 @@ def reload_javascript():
|
||||
for line in lines:
|
||||
if 'meta name="twitter:' in line:
|
||||
res.body = res.body.replace(line.encode("utf8"), b'')
|
||||
# if 'href="https://fonts.googleapis.com"' in line or 'href="https://fonts.gstatic.com"' in line:
|
||||
# res.body = res.body.replace(line.encode("utf8"), b'')
|
||||
if 'iframeResizer.contentWindow.min.js' in line:
|
||||
res.body = res.body.replace(line.encode("utf8"), b'src="file=javascript/iframeResizer.min.js"')
|
||||
res.init_headers()
|
||||
|
||||
Reference in New Issue
Block a user