mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 17:29:22 +01:00
Reorder functions
This commit is contained in:
parent
7224343a70
commit
2048b403a5
@ -4,6 +4,16 @@ import modules.shared as shared
|
|||||||
extension_state = {}
|
extension_state = {}
|
||||||
available_extensions = []
|
available_extensions = []
|
||||||
|
|
||||||
|
def load_extensions():
|
||||||
|
global extension_state
|
||||||
|
for i,ext in enumerate(shared.args.extensions.split(',')):
|
||||||
|
if ext in available_extensions:
|
||||||
|
print(f'Loading the extension "{ext}"... ', end='')
|
||||||
|
ext_string = f"extensions.{ext}.script"
|
||||||
|
exec(f"import {ext_string}")
|
||||||
|
extension_state[ext] = [True, i]
|
||||||
|
print(f'Ok.')
|
||||||
|
|
||||||
def apply_extensions(text, typ):
|
def apply_extensions(text, typ):
|
||||||
for ext in sorted(extension_state, key=lambda x : extension_state[x][1]):
|
for ext in sorted(extension_state, key=lambda x : extension_state[x][1]):
|
||||||
if extension_state[ext][0] == True:
|
if extension_state[ext][0] == True:
|
||||||
@ -26,15 +36,5 @@ def update_extensions_parameters(*kwargs):
|
|||||||
params[param] = eval(f"kwargs[{i}]")
|
params[param] = eval(f"kwargs[{i}]")
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
def load_extensions():
|
|
||||||
global extension_state
|
|
||||||
for i,ext in enumerate(shared.args.extensions.split(',')):
|
|
||||||
if ext in available_extensions:
|
|
||||||
print(f'Loading the extension "{ext}"... ', end='')
|
|
||||||
ext_string = f"extensions.{ext}.script"
|
|
||||||
exec(f"import {ext_string}")
|
|
||||||
extension_state[ext] = [True, i]
|
|
||||||
print(f'Ok.')
|
|
||||||
|
|
||||||
def get_params(name):
|
def get_params(name):
|
||||||
return eval(f"extensions.{name}.script.params")
|
return eval(f"extensions.{name}.script.params")
|
||||||
|
Loading…
Reference in New Issue
Block a user