prepare for gradio 3.45.0
parent
b085fd31e6
commit
10f76d0634
|
|
@ -13,6 +13,7 @@ if logging.getLogger().hasHandlers():
|
|||
log = logging.getLogger("sd")
|
||||
else:
|
||||
import copy
|
||||
|
||||
class ColoredFormatter(logging.Formatter):
|
||||
COLORS = {
|
||||
"DEBUG": "\033[0;36m", # CYAN
|
||||
|
|
@ -62,9 +63,7 @@ class Singleton(abc.ABCMeta, type):
|
|||
|
||||
|
||||
def compare_components_with_ids(components: List[Block], ids: List[int]):
|
||||
return len(components) == len(ids) and all(
|
||||
component._id == _id for component, _id in zip(components, ids)
|
||||
)
|
||||
return len(components) == len(ids) and all(component._id == _id for component, _id in zip(components, ids))
|
||||
|
||||
|
||||
def get_component_by_elem_id(root: Block, elem_id: str):
|
||||
|
|
@ -98,19 +97,20 @@ def get_components_by_ids(root: Block, ids: List[int]):
|
|||
def detect_control_net(root: gr.Blocks, submit: gr.Button):
|
||||
UiControlNetUnit = None
|
||||
|
||||
dependencies: List[dict] = [
|
||||
x
|
||||
for x in root.dependencies
|
||||
if x["trigger"] == "click" and submit._id in x["targets"]
|
||||
]
|
||||
dependencies: List[dict] = []
|
||||
for x in root.dependencies:
|
||||
if isinstance(x["targets"][0], tuple):
|
||||
for target, trigger in x["targets"]:
|
||||
if trigger == "click" and submit._id == target:
|
||||
dependencies.append(x)
|
||||
elif x["trigger"] == "click" and submit._id in x["targets"]:
|
||||
dependencies.append(x)
|
||||
|
||||
for d in dependencies:
|
||||
if len(d["outputs"]) == 1:
|
||||
outputs = get_components_by_ids(root, d["outputs"])
|
||||
output = outputs[0]
|
||||
if (
|
||||
isinstance(output, gr.State)
|
||||
and type(output.value).__name__ == "UiControlNetUnit"
|
||||
):
|
||||
if isinstance(output, gr.State) and type(output.value).__name__ == "UiControlNetUnit":
|
||||
UiControlNetUnit = type(output.value)
|
||||
|
||||
return UiControlNetUnit
|
||||
|
|
@ -183,4 +183,4 @@ def request_with_retry(
|
|||
log.error("[ArtVenture] Error while uploading result")
|
||||
log.error(e)
|
||||
log.debug(traceback.format_exc())
|
||||
return False
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ from PIL import Image
|
|||
from uuid import uuid4
|
||||
from typing import List
|
||||
from collections import defaultdict
|
||||
from modules import shared, script_callbacks, scripts
|
||||
from modules import call_queue, shared, script_callbacks, scripts
|
||||
from modules.shared import list_checkpoint_tiles, refresh_checkpoints
|
||||
from modules.ui import create_refresh_button
|
||||
from modules.ui_common import save_files
|
||||
from modules.generation_parameters_copypaste import (
|
||||
registered_param_bindings,
|
||||
create_buttons,
|
||||
|
|
@ -128,9 +129,15 @@ class Script(scripts.Script):
|
|||
def bind_enqueue_button(self, root: gr.Blocks):
|
||||
generate = self.generate_button
|
||||
is_img2img = self.is_img2img
|
||||
dependencies: List[dict] = [
|
||||
x for x in root.dependencies if x["trigger"] == "click" and generate._id in x["targets"]
|
||||
]
|
||||
dependencies: List[dict] = []
|
||||
|
||||
for x in root.dependencies:
|
||||
if isinstance(x["targets"][0], tuple):
|
||||
for target, trigger in x["targets"]:
|
||||
if trigger == "click" and generate._id == target:
|
||||
dependencies.append(x)
|
||||
elif x["trigger"] == "click" and generate._id in x["targets"]:
|
||||
dependencies.append(x)
|
||||
|
||||
dependency: dict = None
|
||||
cnet_dependency: dict = None
|
||||
|
|
@ -377,8 +384,6 @@ def on_ui_tab(**_kwargs):
|
|||
elem_id="agent_scheduler_history_result_actions",
|
||||
visible=False,
|
||||
) as result_actions:
|
||||
download_files = gr.File(None, file_count="multiple", interactive=False, show_label=False, visible=False, elem_id=f'agent_scheduler_download_files')
|
||||
html_log = gr.HTML(elem_id=f'agent_scheduler_html_log', elem_classes="html-log")
|
||||
try:
|
||||
send_to_buttons = create_buttons(["txt2img", "img2img", "inpaint", "extras"])
|
||||
except:
|
||||
|
|
|
|||
Loading…
Reference in New Issue