MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / save_results

Function save_results

infer.py:430–446  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

428 pipeline = unmerge_lora(pipeline, lora_path, lora_weight, device=device)
429
430def save_results():
431 if not os.path.exists(save_path):
432 os.makedirs(save_path, exist_ok=True)
433
434 index = len([path for path in os.listdir(save_path)]) + 1
435 prefix = str(index).zfill(8)
436 if num_frames == 1:
437 video_path = os.path.join(save_path, prefix + ".png")
438
439 image = sample[0, :, 0]
440 image = image.transpose(0, 1).transpose(1, 2)
441 image = (image * 255).numpy().astype(np.uint8)
442 image = Image.fromarray(image)
443 image.save(video_path)
444 else:
445 video_path = os.path.join(save_path, prefix + ".mp4")
446 save_videos_grid(sample, video_path, fps=fps)
447
448def simple_save_video():
449 if not os.path.exists(save_path):

Callers

nothing calls this directly

Calls 1

save_videos_gridFunction · 0.90

Tested by

no test coverage detected