Spaces:
Configuration error
Configuration error
clean and refactor
Browse files- .gitattributes +4 -0
- animation.py +4 -4
- app.py +8 -8
.gitattributes
CHANGED
@@ -18,3 +18,7 @@ latent_vectors/green_purple.pt filter=lfs diff=lfs merge=lfs -text
|
|
18 |
latent_vectors/lipvector.pt filter=lfs diff=lfs merge=lfs -text
|
19 |
model_checkpoints filter=lfs diff=lfs merge=lfs -text
|
20 |
visualizations filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
18 |
latent_vectors/lipvector.pt filter=lfs diff=lfs merge=lfs -text
|
19 |
model_checkpoints filter=lfs diff=lfs merge=lfs -text
|
20 |
visualizations filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
animation.py
CHANGED
@@ -12,17 +12,17 @@ def create_gif(
|
|
12 |
total_duration, extend_frames, folder="./img_history", gif_name="face_edit.gif"
|
13 |
):
|
14 |
images = []
|
15 |
-
paths = glob.glob(folder + "/*")
|
|
|
16 |
frame_duration = total_duration / len(paths)
|
17 |
print(len(paths), "frame dur", frame_duration)
|
18 |
durations = [frame_duration] * len(paths)
|
19 |
if extend_frames:
|
20 |
durations[0] = 1.5
|
21 |
durations[-1] = 3
|
22 |
-
for file_name in
|
23 |
if file_name.endswith(".png"):
|
24 |
-
|
25 |
-
images.append(imageio.imread(file_path))
|
26 |
imageio.mimsave(gif_name, images, duration=durations)
|
27 |
return gif_name
|
28 |
|
|
|
12 |
total_duration, extend_frames, folder="./img_history", gif_name="face_edit.gif"
|
13 |
):
|
14 |
images = []
|
15 |
+
paths = list(sorted(glob.glob(folder + "/*")))
|
16 |
+
print(paths)
|
17 |
frame_duration = total_duration / len(paths)
|
18 |
print(len(paths), "frame dur", frame_duration)
|
19 |
durations = [frame_duration] * len(paths)
|
20 |
if extend_frames:
|
21 |
durations[0] = 1.5
|
22 |
durations[-1] = 3
|
23 |
+
for file_name in paths:
|
24 |
if file_name.endswith(".png"):
|
25 |
+
images.append(imageio.imread(file_name))
|
|
|
26 |
imageio.mimsave(gif_name, images, duration=durations)
|
27 |
return gif_name
|
28 |
|
app.py
CHANGED
@@ -85,10 +85,17 @@ with gr.Blocks(css="styles.css") as demo:
|
|
85 |
with gr.Row():
|
86 |
base_img = gr.Image(label="Base Image", type="filepath")
|
87 |
blend_img = gr.Image(label="Image for face blending (optional)", type="filepath")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
with gr.Accordion(label="Add Mask", open=False):
|
89 |
mask = gr.Image(tool="sketch", interactive=True)
|
90 |
-
gr.Markdown(value="Note: You must clear the mask using the rewind button every time you want to change the mask (this is a gradio issue)")
|
91 |
set_mask = gr.Button(value="Set mask")
|
|
|
92 |
gr.Text(value="this image shows the mask passed to the model when you press set mask (debugging purposes)")
|
93 |
testim = gr.Image()
|
94 |
with gr.Row():
|
@@ -120,13 +127,6 @@ with gr.Blocks(css="styles.css") as demo:
|
|
120 |
maximum=1.9,
|
121 |
step=0.1,
|
122 |
)
|
123 |
-
blend_weight = gr.Slider(
|
124 |
-
label="Blend faces: 0 is base image, 1 is the second img",
|
125 |
-
minimum=-0.,
|
126 |
-
value=0,
|
127 |
-
maximum=1.,
|
128 |
-
step=0.1,
|
129 |
-
)
|
130 |
asian_weight = gr.Slider(
|
131 |
minimum=-2.,
|
132 |
value=0,
|
|
|
85 |
with gr.Row():
|
86 |
base_img = gr.Image(label="Base Image", type="filepath")
|
87 |
blend_img = gr.Image(label="Image for face blending (optional)", type="filepath")
|
88 |
+
blend_weight = gr.Slider(
|
89 |
+
label="Blend faces: 0 is base image, 1 is the second img",
|
90 |
+
minimum=-0.,
|
91 |
+
value=0,
|
92 |
+
maximum=1.,
|
93 |
+
step=0.1,
|
94 |
+
)
|
95 |
with gr.Accordion(label="Add Mask", open=False):
|
96 |
mask = gr.Image(tool="sketch", interactive=True)
|
|
|
97 |
set_mask = gr.Button(value="Set mask")
|
98 |
+
gr.Markdown(value="Note: You must clear the mask using the rewind button every time you want to change the mask (this is a gradio issue)")
|
99 |
gr.Text(value="this image shows the mask passed to the model when you press set mask (debugging purposes)")
|
100 |
testim = gr.Image()
|
101 |
with gr.Row():
|
|
|
127 |
maximum=1.9,
|
128 |
step=0.1,
|
129 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
asian_weight = gr.Slider(
|
131 |
minimum=-2.,
|
132 |
value=0,
|