make concepts library work with Web UI (#1608)

## The concepts library now works with the Web UI

This PR makes it possible to include a Hugging Face concepts library
<style-or-subject-trigger> in the WebUI prompts. The metadata seems to
be correctly handled.
This commit is contained in:
Damian Stewart 2022-11-29 12:20:05 +01:00 committed by GitHub
commit 8999a5564b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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: