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 31, 2022
1 parent f029b80 commit bbe7c65
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 @@ -69,6 +69,7 @@ def get_controls(q: Q):
Fix Resolution (Increase resolution and fix artifacts in an existing image)",
)
landmark_controls = [
ui.separator(label="Modify"),
ui.slider(
name='age_slider',
label='Age',
Expand Down Expand Up @@ -278,7 +279,7 @@ def get_controls(q: Q):
)
elif q.client.task_choice == 'B':
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 @@ -308,13 +309,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 @@ -118,6 +118,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 bbe7c65

Please sign in to comment.