Spaces:
Running
Running
interface update
Browse files- app.py +52 -29
- editings_table.csv +34 -36
- images/gosling_mask.webp +0 -0
- images/robert_mask.webp +0 -0
- images/scarlet_mask.webp +0 -0
- images/smith_mask.webp +0 -0
- images/watson_mask.webp +0 -0
app.py
CHANGED
|
@@ -16,27 +16,26 @@ PREDEFINED_EDITINGS_DATA = {
|
|
| 16 |
"makeup": ([-10.0, 15.0], False),
|
| 17 |
"eye_openness": ([-45.0, 30.0], True),
|
| 18 |
"trimmed_beard": ([-30.0, 30.0], True),
|
| 19 |
-
"lipstick": ([-60.0, 60.0], False), # ??
|
| 20 |
"face_roundness": ([-20.0, 15.0], False),
|
| 21 |
"nose_length": ([-30.0, 30.0], True),
|
| 22 |
"eyebrow_thickness": ([-20.0, 20.0], True),
|
| 23 |
"displeased": ([-10.0, 10.0], False),
|
| 24 |
"age": ([-10.0, 10.0], False),
|
| 25 |
"rotation": ([-7.0, 7.0], False),
|
| 26 |
-
"afro": ([0
|
| 27 |
-
"angry": ([0
|
| 28 |
-
"bobcut": ([0
|
| 29 |
-
"bowlcut": ([0
|
| 30 |
-
"mohawk": ([0
|
| 31 |
-
"curly_hair": ([0
|
| 32 |
-
"purple_hair": ([0
|
| 33 |
-
"surprised": ([0
|
| 34 |
-
"beyonce": ([0
|
| 35 |
-
"hilary_clinton": ([0
|
| 36 |
-
"depp": ([0
|
| 37 |
-
"taylor_swift": ([0
|
| 38 |
-
"trump": ([0
|
| 39 |
-
"zuckerberg": ([0
|
| 40 |
"black hair": ([-7.0, 10.0], False),
|
| 41 |
"blond hair": ([-7.0, 10.0], True),
|
| 42 |
"grey hair": ([-7.0, 7.0], True),
|
|
@@ -44,14 +43,14 @@ PREDEFINED_EDITINGS_DATA = {
|
|
| 44 |
"receding hairline": ([-10.0, 10.0], True),
|
| 45 |
"sideburns": ([-7.0, 7.0], True),
|
| 46 |
"goatee": ([-7.0, 7.0], True),
|
| 47 |
-
"
|
| 48 |
-
"gender": ([-10.0, 7.0], False)
|
| 49 |
}
|
| 50 |
|
| 51 |
DIRECTIONS_NAME_SWAP = {
|
| 52 |
"smile" : "fs_smiling",
|
| 53 |
"glasses": "fs_glasses",
|
| 54 |
"makeup": "fs_makeup",
|
|
|
|
| 55 |
}
|
| 56 |
|
| 57 |
|
|
@@ -165,16 +164,17 @@ def get_demo():
|
|
| 165 |
|
| 166 |
**Editing power** -- the greater the absolute value of this parameter, the more the selected edit will appear. Better use values in the range 7 - 13, lower values may not give the desired edit, higher values -- on the contrary -- may apply edit too much and create artefacts.
|
| 167 |
|
| 168 |
-
**
|
|
|
|
|
|
|
| 169 |
'''
|
| 170 |
)
|
| 171 |
|
| 172 |
-
gr.Dataframe(value=editings_table, datatype=["markdown","markdown","markdown"], interactive=False, wrap=True,
|
| 173 |
-
column_widths=["
|
| 174 |
with gr.Row():
|
| 175 |
predef_editing_direction = gr.Dropdown(list(PREDEFINED_EDITINGS_DATA.keys()), label="Editing direction", value="smile")
|
| 176 |
-
|
| 177 |
-
predef_editing_power = gr.Slider(-20, 20, value=10, step=0.1, label="Editing power")
|
| 178 |
btn_predef = gr.Button("Edit image")
|
| 179 |
|
| 180 |
with gr.Accordion("Text Prompt (StyleClip) Editings", open=False):
|
|
@@ -220,15 +220,38 @@ def get_demo():
|
|
| 220 |
error_message = gr.Textbox(label="⚠️ Error ⚠️", visible=False, elem_classes="error-message")
|
| 221 |
gr.Markdown("If artefacts appear during editing -- try lowering the editing power or using a mask.")
|
| 222 |
gr.Examples(
|
| 223 |
-
label="Input Examples",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
examples=[
|
| 225 |
-
["images/scarlet.jpg"
|
| 226 |
-
["images/gosling.jpg"
|
| 227 |
-
["images/robert.png"
|
| 228 |
-
["images/smith.jpg"
|
| 229 |
-
["images/watson.jpeg"
|
| 230 |
],
|
| 231 |
-
inputs=[
|
| 232 |
)
|
| 233 |
|
| 234 |
|
|
|
|
| 16 |
"makeup": ([-10.0, 15.0], False),
|
| 17 |
"eye_openness": ([-45.0, 30.0], True),
|
| 18 |
"trimmed_beard": ([-30.0, 30.0], True),
|
|
|
|
| 19 |
"face_roundness": ([-20.0, 15.0], False),
|
| 20 |
"nose_length": ([-30.0, 30.0], True),
|
| 21 |
"eyebrow_thickness": ([-20.0, 20.0], True),
|
| 22 |
"displeased": ([-10.0, 10.0], False),
|
| 23 |
"age": ([-10.0, 10.0], False),
|
| 24 |
"rotation": ([-7.0, 7.0], False),
|
| 25 |
+
"afro": ([0, 0.14], False),
|
| 26 |
+
"angry": ([0, 0.14], False),
|
| 27 |
+
"bobcut": ([0, 0.18], False),
|
| 28 |
+
"bowlcut": ([0, 0.14], False),
|
| 29 |
+
"mohawk": ([0, 0.1], False),
|
| 30 |
+
"curly_hair": ([0, 0.12], False),
|
| 31 |
+
"purple_hair": ([0, 0.12], False),
|
| 32 |
+
"surprised": ([0, 0.1], False),
|
| 33 |
+
"beyonce": ([0, 0.12], False),
|
| 34 |
+
"hilary_clinton": ([0, 0.1], False),
|
| 35 |
+
"depp": ([0, 0.12], False),
|
| 36 |
+
"taylor_swift": ([0, 0.1], False),
|
| 37 |
+
"trump": ([0, 0.1], False),
|
| 38 |
+
"zuckerberg": ([0, 0.1], False),
|
| 39 |
"black hair": ([-7.0, 10.0], False),
|
| 40 |
"blond hair": ([-7.0, 10.0], True),
|
| 41 |
"grey hair": ([-7.0, 7.0], True),
|
|
|
|
| 43 |
"receding hairline": ([-10.0, 10.0], True),
|
| 44 |
"sideburns": ([-7.0, 7.0], True),
|
| 45 |
"goatee": ([-7.0, 7.0], True),
|
| 46 |
+
"gender swap": ([-10.0, 7.0], False)
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
DIRECTIONS_NAME_SWAP = {
|
| 50 |
"smile" : "fs_smiling",
|
| 51 |
"glasses": "fs_glasses",
|
| 52 |
"makeup": "fs_makeup",
|
| 53 |
+
"gender swap": "gender"
|
| 54 |
}
|
| 55 |
|
| 56 |
|
|
|
|
| 164 |
|
| 165 |
**Editing power** -- the greater the absolute value of this parameter, the more the selected edit will appear. Better use values in the range 7 - 13, lower values may not give the desired edit, higher values -- on the contrary -- may apply edit too much and create artefacts.
|
| 166 |
|
| 167 |
+
**Positive effect** -- the effect applied to the image when positive editing power is used.
|
| 168 |
+
|
| 169 |
+
**Negative effect** -- the effect applied to the image when negative editing power is used. It is usually the opposite of the positive effect.
|
| 170 |
'''
|
| 171 |
)
|
| 172 |
|
| 173 |
+
gr.Dataframe(value=editings_table, datatype=["markdown","markdown","markdown","markdown"], interactive=False, wrap=True,
|
| 174 |
+
column_widths=["25px", "25px", "25px", "25px"], height=300) # 100
|
| 175 |
with gr.Row():
|
| 176 |
predef_editing_direction = gr.Dropdown(list(PREDEFINED_EDITINGS_DATA.keys()), label="Editing direction", value="smile")
|
| 177 |
+
predef_editing_power = gr.Slider(-20, 20, value=7, step=0.1, label="Editing power")
|
|
|
|
| 178 |
btn_predef = gr.Button("Edit image")
|
| 179 |
|
| 180 |
with gr.Accordion("Text Prompt (StyleClip) Editings", open=False):
|
|
|
|
| 220 |
error_message = gr.Textbox(label="⚠️ Error ⚠️", visible=False, elem_classes="error-message")
|
| 221 |
gr.Markdown("If artefacts appear during editing -- try lowering the editing power or using a mask.")
|
| 222 |
gr.Examples(
|
| 223 |
+
label="Input Examples for editing",
|
| 224 |
+
examples=[
|
| 225 |
+
["images/scarlet.jpg"],
|
| 226 |
+
["images/gosling.jpg"],
|
| 227 |
+
["images/robert.png"],
|
| 228 |
+
["images/smith.jpg"],
|
| 229 |
+
["images/watson.jpeg"],
|
| 230 |
+
],
|
| 231 |
+
inputs=[input_image],
|
| 232 |
+
examples_per_page=5
|
| 233 |
+
)
|
| 234 |
+
gr.Examples(
|
| 235 |
+
label="Mask Examples for editing",
|
| 236 |
+
examples=[
|
| 237 |
+
["images/scarlet_mask.webp"],
|
| 238 |
+
["images/gosling_mask.webp"],
|
| 239 |
+
["images/robert_mask.webp"],
|
| 240 |
+
["images/smith_mask.webp"],
|
| 241 |
+
["images/watson_mask.webp"],
|
| 242 |
+
],
|
| 243 |
+
inputs=[mask]
|
| 244 |
+
)
|
| 245 |
+
gr.Examples(
|
| 246 |
+
label="Input Examples for Mask generation",
|
| 247 |
examples=[
|
| 248 |
+
["images/scarlet.jpg"],
|
| 249 |
+
["images/gosling.jpg"],
|
| 250 |
+
["images/robert.png"],
|
| 251 |
+
["images/smith.jpg"],
|
| 252 |
+
["images/watson.jpeg"],
|
| 253 |
],
|
| 254 |
+
inputs=[input_mask]
|
| 255 |
)
|
| 256 |
|
| 257 |
|
editings_table.csv
CHANGED
|
@@ -1,36 +1,34 @@
|
|
| 1 |
-
Editing name,
|
| 2 |
-
glasses,add glasses,may open mouth
|
| 3 |
-
smile,add smile,
|
| 4 |
-
makeup,add make-up,
|
| 5 |
-
eye_openness,open eyes,
|
| 6 |
-
trimmed_beard,add beard,
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
earrings,add earrings,bad works with men
|
| 36 |
-
gender,add femininity,better use global mapper
|
|
|
|
| 1 |
+
Editing name,Positive effect,Negative effect,Additional comments
|
| 2 |
+
glasses,add glasses,remove glasses,may open mouth
|
| 3 |
+
smile,add smile,remove smile,
|
| 4 |
+
makeup,add make-up,remove makeup,doesn't work well with men
|
| 5 |
+
eye_openness,open eyes,close eyes,
|
| 6 |
+
trimmed_beard,add beard,remove beard,doesn't work well with women
|
| 7 |
+
face_roundness,make face rounder,make face narrower,
|
| 8 |
+
nose_length,increase nose length,decrease nose length,may open mouth
|
| 9 |
+
eyebrow_thickness,increase eyebrow thickness,decrease eyebrow thickness,
|
| 10 |
+
displeased,add sadness,add smile,
|
| 11 |
+
age,increase age,decrease age,
|
| 12 |
+
rotation,turn face right,turn face left,
|
| 13 |
+
afro,afro hairstyle,None,
|
| 14 |
+
angry,make angrier,None,cause background artefacts
|
| 15 |
+
bobcut,bobcut hairstyle,None,cause background artefacts
|
| 16 |
+
bowlcut,bowlcut hairstyle,None,cause background artefacts
|
| 17 |
+
mohawk,mohawk hairstyle,None,cause background artefacts
|
| 18 |
+
curly_hair,add curls,None,
|
| 19 |
+
purple_hair,dye hair purple,None,
|
| 20 |
+
surprised,make more surprised,None,
|
| 21 |
+
beyonce,make similar to beyonce,None,
|
| 22 |
+
hilary_clinton,make similar to hilary clinton,None,
|
| 23 |
+
depp,make similar to johnny depp,None,
|
| 24 |
+
taylor_swift,make similar to taylor swift,None,
|
| 25 |
+
trump,make similar to donald trump,None,
|
| 26 |
+
zuckerberg,make similar to mark zuckerberg,None,
|
| 27 |
+
black hair,darken hair,lighten hair,
|
| 28 |
+
blond hair,lighten hair,darken hair,
|
| 29 |
+
grey hair,make hair grey,make hair brown,
|
| 30 |
+
wavy hair,increase hair length,decrease hair length,
|
| 31 |
+
receding hairline,add bald,remove bald,
|
| 32 |
+
sideburns,add sideburns,remove sideburns,doesn't work well with women
|
| 33 |
+
goatee,add goatee,remove goatee,doesn't work well with women
|
| 34 |
+
gender swap,swap to woman,swap to man,better use global mapper
|
|
|
|
|
|
images/gosling_mask.webp
ADDED
|
images/robert_mask.webp
ADDED
|
images/scarlet_mask.webp
ADDED
|
images/smith_mask.webp
ADDED
|
images/watson_mask.webp
ADDED
|