-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split face_analyser and face_selector UI, Adjust filter_by_age values
- Loading branch information
Showing
6 changed files
with
73 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from typing import Optional | ||
|
||
import gradio | ||
|
||
import roop.globals | ||
from roop.uis import core as ui | ||
from roop.uis.typing import Update | ||
|
||
FACE_ANALYSER_DIRECTION_DROPDOWN: Optional[gradio.Dropdown] = None | ||
FACE_ANALYSER_AGE_DROPDOWN: Optional[gradio.Dropdown] = None | ||
FACE_ANALYSER_GENDER_DROPDOWN: Optional[gradio.Dropdown] = None | ||
|
||
|
||
def render() -> None: | ||
global FACE_ANALYSER_DIRECTION_DROPDOWN | ||
global FACE_ANALYSER_AGE_DROPDOWN | ||
global FACE_ANALYSER_GENDER_DROPDOWN | ||
|
||
with gradio.Box(): | ||
with gradio.Row(): | ||
FACE_ANALYSER_DIRECTION_DROPDOWN = gradio.Dropdown( | ||
label='FACE ANALYSER DIRECTION', | ||
choices=['none', 'left-right', 'right-left', 'top-bottom', 'bottom-top', 'small-large', 'large-small'], | ||
value=roop.globals.face_analyser_direction or 'none' | ||
) | ||
FACE_ANALYSER_AGE_DROPDOWN = gradio.Dropdown( | ||
label='FACE ANALYSER AGE', | ||
choices=['none', 'child', 'teen', 'adult', 'senior'], | ||
value=roop.globals.face_analyser_age or 'none' | ||
) | ||
FACE_ANALYSER_GENDER_DROPDOWN = gradio.Dropdown( | ||
label='FACE ANALYSER GENDER', | ||
choices=['none', 'male', 'female'], | ||
value=roop.globals.face_analyser_gender or 'none' | ||
) | ||
ui.register_component('face_analyser_direction_dropdown', FACE_ANALYSER_DIRECTION_DROPDOWN) | ||
ui.register_component('face_analyser_age_dropdown', FACE_ANALYSER_AGE_DROPDOWN) | ||
ui.register_component('face_analyser_gender_dropdown', FACE_ANALYSER_GENDER_DROPDOWN) | ||
|
||
|
||
def listen() -> None: | ||
FACE_ANALYSER_DIRECTION_DROPDOWN.select(lambda value: update_dropdown('face_analyser_direction', value), inputs=FACE_ANALYSER_DIRECTION_DROPDOWN, outputs=FACE_ANALYSER_DIRECTION_DROPDOWN) | ||
FACE_ANALYSER_AGE_DROPDOWN.select(lambda value: update_dropdown('face_analyser_age', value), inputs=FACE_ANALYSER_AGE_DROPDOWN, outputs=FACE_ANALYSER_AGE_DROPDOWN) | ||
FACE_ANALYSER_GENDER_DROPDOWN.select(lambda value: update_dropdown('face_analyser_gender', value), inputs=FACE_ANALYSER_GENDER_DROPDOWN, outputs=FACE_ANALYSER_GENDER_DROPDOWN) | ||
|
||
|
||
def update_dropdown(name: str, value: str) -> Update: | ||
if value == 'none': | ||
setattr(roop.globals, name, None) | ||
else: | ||
setattr(roop.globals, name, value) | ||
return gradio.update(value=value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters