make concepts library work with Web UI

This PR makes it possible to include a Hugging Face concepts library
<style-or-subject-trigger> in the WebUI prompt. The metadata seems
to be correctly handled.
This commit is contained in:
Lincoln Stein 2022-11-28 23:37:46 +00:00
parent 45e51bac9a
commit 62cda009dd
2 changed files with 3 additions and 2 deletions

View File

@ -436,6 +436,9 @@ class Generate:
self.sampler_name = sampler_name
self._set_sampler()
# apply the concepts library to the prompt
prompt = self.concept_lib().replace_concepts_with_triggers(prompt, lambda concepts: self.load_concepts(concepts))
# bit of a hack to change the cached sampler's karras threshold to
# whatever the user asked for
if karras_max is not None and isinstance(self.sampler,KSampler):

View File

@ -352,8 +352,6 @@ def main_loop(gen, opt):
last_results.append([path, seed])
if operation == 'generate':
# load any <embeddings> from the SD concepts library
opt.prompt = gen.concept_lib().replace_concepts_with_triggers(opt.prompt, lambda concepts: gen.load_concepts(concepts))
catch_ctrl_c = infile is None # if running interactively, we catch keyboard interrupts
opt.last_operation='generate'
try: