diff --git a/img_styler/ui/components.py b/img_styler/ui/components.py index 1b6fa13..91fb859 100644 --- a/img_styler/ui/components.py +++ b/img_styler/ui/components.py @@ -54,6 +54,7 @@ def get_user_title(q: Q): def get_controls(q: Q): task_choices = [ui.choice('A', 'Image Styling'), ui.choice('B', 'Image Editing')] landmark_controls = [ + ui.separator(label="Modify"), ui.slider( name='age_slider', label='Age', @@ -273,7 +274,7 @@ def get_controls(q: Q): ) else: style_names = { - 'none': 'None', 'anime': 'Anime', 'botero': 'Botero', 'crochet': 'Crochet', 'cubism': 'Cubism', + 'none': 'None', 'prompt': 'Prompt', 'anime': 'Anime', 'botero': 'Botero', 'crochet': 'Crochet', 'cubism': 'Cubism', 'disney_princess': 'Disney Princess', 'edvard_munch': 'Edvard Munch', 'elf': 'Elf', 'ghibli': 'Ghibli', 'grafitti_on_wall': 'Grafitti on Wall', 'groot': 'Groot', 'joker': 'Joker', 'marble': 'Marble', 'modernism': 'Modernism', 'modigliani': 'Modigliani', 'mona_lisa': 'Mona Lisa', 'oil': 'Oil', @@ -313,13 +314,14 @@ def get_controls(q: Q): ), ui.dropdown( name='source_style', - label='Style', + label='Styles', choices=[ ui.choice(name=f'style_{x}', label=style_names[x]) for x in style_names ], value=q.client.source_style or 'style_none', - tooltip='Select a style to adapt.', + tooltip='Select a pre-configured style to adapt.', + trigger = True ), ui.buttons( [ diff --git a/img_styler/ui/handlers.py b/img_styler/ui/handlers.py index 6819f7c..a68f9b7 100644 --- a/img_styler/ui/handlers.py +++ b/img_styler/ui/handlers.py @@ -87,6 +87,11 @@ async def process(q: Q): await update_faces(q) await update_processed_face(q) await update_gif(q) + if q.args.task_dropdown == 'B' and q.args.source_style is not None: + styles = q.args.source_style[len('style_'):] + q.client.source_style = q.args.source_style + if styles == 'prompt': + logger.info(f"Prompt action selected: {styles}") if q.args.apply: await apply(q) if hash == 'capture':