Skip to content

Commit

Permalink
Initial trigger for prompt #5
Browse files Browse the repository at this point in the history
  • Loading branch information
pramitchoudhary committed Oct 17, 2022
1 parent 06d81c1 commit af7b050
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions img_styler/ui/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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(
[
Expand Down
5 changes: 5 additions & 0 deletions img_styler/ui/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit af7b050

Please sign in to comment.