jhj0517
commited on
Commit
•
e6d5b51
1
Parent(s):
80de2f9
Add constant and apply
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ class App:
|
|
39 |
gr.Slider(label=_("Source Ratio"), minimum=0, maximum=1, step=0.01, value=1),
|
40 |
gr.Slider(label=_("Sample Ratio"), minimum=-0.2, maximum=1.2, step=0.01, value=1),
|
41 |
gr.Dropdown(label=_("Sample Parts"),
|
42 |
-
choices=[
|
43 |
gr.Slider(label=_("Crop Factor"), minimum=1.5, maximum=2.5, step=0.1, value=1.7)
|
44 |
]
|
45 |
|
|
|
39 |
gr.Slider(label=_("Source Ratio"), minimum=0, maximum=1, step=0.01, value=1),
|
40 |
gr.Slider(label=_("Sample Ratio"), minimum=-0.2, maximum=1.2, step=0.01, value=1),
|
41 |
gr.Dropdown(label=_("Sample Parts"),
|
42 |
+
choices=[part.value for part in SamplePart], value=SamplePart.ALL.value),
|
43 |
gr.Slider(label=_("Crop Factor"), minimum=1.5, maximum=2.5, step=0.1, value=1.7)
|
44 |
]
|
45 |
|
modules/live_portrait/live_portrait_inferencer.py
CHANGED
@@ -201,15 +201,15 @@ class LivePortraitInferencer:
|
|
201 |
self.d_info['exp'][0, 5, 1] = 0
|
202 |
|
203 |
# "OnlyExpression", "OnlyRotation", "OnlyMouth", "OnlyEyes", "All"
|
204 |
-
if sample_parts ==
|
205 |
es.e += self.d_info['exp'] * sample_ratio
|
206 |
-
if sample_parts ==
|
207 |
rotate_pitch += self.d_info['pitch'] * sample_ratio
|
208 |
rotate_yaw += self.d_info['yaw'] * sample_ratio
|
209 |
rotate_roll += self.d_info['roll'] * sample_ratio
|
210 |
-
elif sample_parts ==
|
211 |
self.retargeting(es.e, self.d_info['exp'], sample_ratio, (14, 17, 19, 20))
|
212 |
-
elif sample_parts ==
|
213 |
self.retargeting(es.e, self.d_info['exp'], sample_ratio, (1, 2, 11, 13, 15, 16))
|
214 |
|
215 |
es.r = self.calc_fe(es.e, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile,
|
|
|
201 |
self.d_info['exp'][0, 5, 1] = 0
|
202 |
|
203 |
# "OnlyExpression", "OnlyRotation", "OnlyMouth", "OnlyEyes", "All"
|
204 |
+
if sample_parts == SamplePart.ONLY_EXPRESSION.value or sample_parts == SamplePart.ONLY_EXPRESSION.ALL.value:
|
205 |
es.e += self.d_info['exp'] * sample_ratio
|
206 |
+
if sample_parts == SamplePart.ONLY_ROTATION.value or sample_parts == SamplePart.ONLY_ROTATION.ALL.value:
|
207 |
rotate_pitch += self.d_info['pitch'] * sample_ratio
|
208 |
rotate_yaw += self.d_info['yaw'] * sample_ratio
|
209 |
rotate_roll += self.d_info['roll'] * sample_ratio
|
210 |
+
elif sample_parts == SamplePart.ONLY_MOUTH.value:
|
211 |
self.retargeting(es.e, self.d_info['exp'], sample_ratio, (14, 17, 19, 20))
|
212 |
+
elif sample_parts == SamplePart.ONLY_EYES.value:
|
213 |
self.retargeting(es.e, self.d_info['exp'], sample_ratio, (1, 2, 11, 13, 15, 16))
|
214 |
|
215 |
es.r = self.calc_fe(es.e, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile,
|
modules/utils/constants.py
CHANGED
@@ -7,6 +7,14 @@ class ModelType(Enum):
|
|
7 |
ANIMAL = _("Animal")
|
8 |
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
REPO_MARKDOWN = """
|
11 |
## [AdvancedLivePortrait-WebUI](https://github.com/jhj0517/AdvancedLivePortrait-WebUI/tree/master)
|
12 |
"""
|
|
|
7 |
ANIMAL = _("Animal")
|
8 |
|
9 |
|
10 |
+
class SamplePart(Enum):
|
11 |
+
ONLY_EXPRESSION = _("OnlyExpression")
|
12 |
+
ONLY_ROTATION = _("OnlyRotation")
|
13 |
+
ONLY_MOUTH = _("OnlyMouth")
|
14 |
+
ONLY_EYES = _("OnlyEyes")
|
15 |
+
ALL = _("All")
|
16 |
+
|
17 |
+
|
18 |
REPO_MARKDOWN = """
|
19 |
## [AdvancedLivePortrait-WebUI](https://github.com/jhj0517/AdvancedLivePortrait-WebUI/tree/master)
|
20 |
"""
|