Add setup method to extensions

This commit is contained in:
Maya 2023-03-19 13:22:24 +00:00
parent bd27353a08
commit 099d7a844b
2 changed files with 10 additions and 6 deletions

View file

@ -5,6 +5,7 @@ import modules.shared as shared
state = {}
available_extensions = []
setup_called = False
def load_extensions():
global state
@ -44,6 +45,13 @@ def create_extensions_block():
if _id in shared.settings:
extension.params[param] = shared.settings[_id]
# Running setup function
if not setup_called:
for extension, name in iterator():
if hasattr(extension, "setup"):
extension.setup()
setup_called = True
# Creating the extension ui elements
if len(state) > 0:
with gr.Box(elem_id="extensions"):