CiaraRowles
commited on
Commit
•
798a8f1
1
Parent(s):
b5b1781
Updated temporalvideo.py to work with the dif checkpoint.
Browse files- temporalvideo.py +20 -20
temporalvideo.py
CHANGED
@@ -23,47 +23,47 @@ def get_image_paths(folder):
|
|
23 |
|
24 |
y_paths = get_image_paths(y_folder)
|
25 |
|
26 |
-
def send_request(
|
27 |
url = "http://localhost:7860/sdapi/v1/img2img"
|
28 |
|
29 |
-
with open(
|
30 |
-
|
31 |
|
32 |
-
with open(
|
33 |
-
|
34 |
|
35 |
data = {
|
36 |
-
"init_images": [
|
37 |
"inpainting_fill": 0,
|
38 |
"inpaint_full_res": True,
|
39 |
"inpaint_full_res_padding": 1,
|
40 |
"inpainting_mask_invert": 1,
|
41 |
"resize_mode": 0,
|
42 |
-
"denoising_strength": 0.
|
43 |
-
"prompt": "
|
44 |
"negative_prompt": "(ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head",
|
45 |
"alwayson_scripts": {
|
46 |
"ControlNet":{
|
47 |
"args": [
|
48 |
{
|
49 |
-
"input_image":
|
50 |
"module": "hed",
|
51 |
"model": "control_hed-fp16 [13fee50b]",
|
52 |
-
"weight": 1,
|
53 |
-
"guidance":
|
54 |
-
|
55 |
{
|
56 |
-
"input_image":
|
57 |
-
"model": "
|
58 |
"module": "none",
|
59 |
-
"weight":
|
60 |
-
"guidance":
|
61 |
}
|
62 |
|
63 |
]
|
64 |
}
|
65 |
},
|
66 |
-
"seed":
|
67 |
"subseed": -1,
|
68 |
"subseed_strength": -1,
|
69 |
"sampler_index": "Euler a",
|
@@ -71,8 +71,8 @@ def send_request(init_image_path, temp_path,controlnet_input_image_path):
|
|
71 |
"n_iter": 1,
|
72 |
"steps": 20,
|
73 |
"cfg_scale": 6,
|
74 |
-
"width":
|
75 |
-
"height":
|
76 |
"restore_faces": True,
|
77 |
"include_init_images": True,
|
78 |
"override_settings": {},
|
@@ -103,7 +103,7 @@ for i in range(1, len(y_paths)):
|
|
103 |
with open(temp_image_path, "wb") as f:
|
104 |
f.write(base64.b64decode(encoded_image))
|
105 |
output_paths.append(temp_image_path)
|
106 |
-
result = send_request(
|
107 |
output_images.append(result)
|
108 |
print(f"Written data for frame {i}:")
|
109 |
|
|
|
23 |
|
24 |
y_paths = get_image_paths(y_folder)
|
25 |
|
26 |
+
def send_request(last_image_path, temp_path,current_image_path):
|
27 |
url = "http://localhost:7860/sdapi/v1/img2img"
|
28 |
|
29 |
+
with open(last_image_path, "rb") as f:
|
30 |
+
last_image = base64.b64encode(f.read()).decode("utf-8")
|
31 |
|
32 |
+
with open(current_image_path, "rb") as b:
|
33 |
+
current_image = base64.b64encode(b.read()).decode("utf-8")
|
34 |
|
35 |
data = {
|
36 |
+
"init_images": [current_image],
|
37 |
"inpainting_fill": 0,
|
38 |
"inpaint_full_res": True,
|
39 |
"inpaint_full_res_padding": 1,
|
40 |
"inpainting_mask_invert": 1,
|
41 |
"resize_mode": 0,
|
42 |
+
"denoising_strength": 0.45,
|
43 |
+
"prompt": "pop art, painting, highly detailed,",
|
44 |
"negative_prompt": "(ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head",
|
45 |
"alwayson_scripts": {
|
46 |
"ControlNet":{
|
47 |
"args": [
|
48 |
{
|
49 |
+
"input_image": current_image,
|
50 |
"module": "hed",
|
51 |
"model": "control_hed-fp16 [13fee50b]",
|
52 |
+
"weight": 1.5,
|
53 |
+
"guidance": 1,
|
54 |
+
},
|
55 |
{
|
56 |
+
"input_image": last_image,
|
57 |
+
"model": "diff_control_sd15_temporalnet_fp16 [adc6bd97]",
|
58 |
"module": "none",
|
59 |
+
"weight": 0.7,
|
60 |
+
"guidance": 1,
|
61 |
}
|
62 |
|
63 |
]
|
64 |
}
|
65 |
},
|
66 |
+
"seed": 3189343382,
|
67 |
"subseed": -1,
|
68 |
"subseed_strength": -1,
|
69 |
"sampler_index": "Euler a",
|
|
|
71 |
"n_iter": 1,
|
72 |
"steps": 20,
|
73 |
"cfg_scale": 6,
|
74 |
+
"width": 512,
|
75 |
+
"height": 512,
|
76 |
"restore_faces": True,
|
77 |
"include_init_images": True,
|
78 |
"override_settings": {},
|
|
|
103 |
with open(temp_image_path, "wb") as f:
|
104 |
f.write(base64.b64decode(encoded_image))
|
105 |
output_paths.append(temp_image_path)
|
106 |
+
result = send_request(temp_image_path, y_folder, y_paths[i])
|
107 |
output_images.append(result)
|
108 |
print(f"Written data for frame {i}:")
|
109 |
|