1
0
Fork 0

feat(api): load i18n labels from additional networks

This commit is contained in:
Sean Sube 2023-03-18 19:25:22 -05:00
parent 2e89fd43d3
commit f8f36e602c
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 17 additions and 3 deletions

View File

@ -142,7 +142,7 @@ def load_extras(context: ServerContext):
logger.debug("collecting strings from %s", file) logger.debug("collecting strings from %s", file)
merge(strings, data["strings"]) merge(strings, data["strings"])
for model_type in ["diffusion", "correction", "upscaling"]: for model_type in ["diffusion", "correction", "upscaling", "networks"]:
if model_type in data: if model_type in data:
for model in data[model_type]: for model in data[model_type]:
if "label" in model: if "label" in model:
@ -159,14 +159,28 @@ def load_extras(context: ServerContext):
if "label" in inversion: if "label" in inversion:
inversion_name = inversion["name"] inversion_name = inversion["name"]
logger.debug( logger.debug(
"collecting label for inversion %s from %s", "collecting label for Textual Inversion %s from %s",
inversion_name, inversion_name,
model_name, model_name,
) )
labels[ labels[
f"inversion-{inversion_name}" f"inversion.{inversion_name}"
] = inversion["label"] ] = inversion["label"]
if "loras" in model:
for lora in model["loras"]:
if "label" in lora:
lora_name = lora["name"]
logger.debug(
"collecting label for LoRA %s from %s",
lora_name,
model_name,
)
labels[
f"lora.{lora_name}"
] = lora["label"]
except Exception: except Exception:
logger.exception("error loading extras file") logger.exception("error loading extras file")