一路向西2之泰西
三级小说你的位置:一路向西2之泰西 > 三级小说 >

乱伦qvod 修改facefusion 换脸历程中产生的临时图片文献的保存目次 附代码

发布日期:2024-10-14 04:20    点击次数:100

  

乱伦qvod 修改facefusion 换脸历程中产生的临时图片文献的保存目次  附代码

之前有不少的小伙伴给我的视频留言乱伦qvod,说facefusion换脸历程中会产生许多临时的图片文献,而况这些图片默许就保存在c盘

这个目次下 C:\Users\yourname\AppData\Local\Temp\facefusion

若是你的视频很大的话,那么产生的临时文献就会占用很大的c盘空间,也许许多小伙伴的C盘空间并不富足,是以换脸完成后这些缓存图片皆会自动删除,然而还是会占用一段时辰,是以我今天抽空花了5分钟修改了下

收场了 把临时图片文献放在facefusion 地点目次下的tmp这个文献夹内部。等换脸完成以后会自动删除这个文献夹。

视频演示

乱伦qvod

大开facefusion 找到这个文献filesystem.py 然后复制以下代码到内部即可

from typing import List, Optional
import glob
import os
import shutil
import tempfile
import filetype
from pathlib import Path

import facefusion.globals
from facefusion.common_helper import is_windows

if is_windows():
    import ctypes


def get_temp_frame_paths(target_path: str) -> List[str]:
    temp_frames_pattern = get_temp_frames_pattern(target_path, '*')
    return sorted(glob.glob(temp_frames_pattern))


def get_temp_frames_pattern(target_path: str, temp_frame_prefix: str) -> str:
    temp_directory_path = get_temp_directory_path(target_path)
    return os.path.join(temp_directory_path, temp_frame_prefix + '.' + facefusion.globals.temp_frame_format)


def get_temp_file_path(target_path: str) -> str:
    _, target_extension = os.path.splitext(os.path.basename(target_path))
    temp_directory_path = get_temp_directory_path(target_path)
    return os.path.join(temp_directory_path, 'temp' + target_extension)


def get_temp_directory_path(target_path: str) -> str:
    target_name, _ = os.path.splitext(os.path.basename(target_path))
    current_script_path = os.path.abspath(__file__)
    current_script_dir = os.path.dirname(current_script_path)
    parent_dir = os.path.dirname(current_script_dir)
    temp_directory_path = os.path.join(parent_dir, 'tmp')
    return os.path.join(temp_directory_path, target_name)


def create_temp(target_path: str) -> None:
    temp_directory_path = get_temp_directory_path(target_path)
    Path(temp_directory_path).mkdir(parents=True, exist_ok=True)


def move_temp(target_path: str, output_path: str) -> None:
    temp_file_path = get_temp_file_path(target_path)

    if is_file(temp_file_path):
        if is_file(output_path):
            os.remove(output_path)
        shutil.move(temp_file_path, output_path)


def clear_temp(target_path: str) -> None:
    temp_directory_path = get_temp_directory_path(target_path)
    parent_directory_path = os.path.dirname(temp_directory_path)

    if not facefusion.globals.keep_temp and is_directory(temp_directory_path):
        shutil.rmtree(temp_directory_path, ignore_errors=True)
    if os.path.exists(parent_directory_path) and not os.listdir(parent_directory_path):
        os.rmdir(parent_directory_path)


def get_file_size(file_path: str) -> int:
    if is_file(file_path):
        return os.path.getsize(file_path)
    return 0


def is_file(file_path: str) -> bool:
    return bool(file_path and os.path.isfile(file_path))


def is_directory(directory_path: str) -> bool:
    return bool(directory_path and os.path.isdir(directory_path))


def is_audio(audio_path: str) -> bool:
    return is_file(audio_path) and filetype.helpers.is_audio(audio_path)


def has_audio(audio_paths: List[str]) -> bool:
    if audio_paths:
        return any(is_audio(audio_path) for audio_path in audio_paths)
    return False


def is_image(image_path: str) -> bool:
    return is_file(image_path) and filetype.helpers.is_image(image_path)


def has_image(image_paths: List[str]) -> bool:
    if image_paths:
        return any(is_image(image_path) for image_path in image_paths)
    return False


def is_video(video_path: str) -> bool:
    return is_file(video_path) and filetype.helpers.is_video(video_path)


def filter_audio_paths(paths: List[str]) -> List[str]:
    if paths:
        return [path for path in paths if is_audio(path)]
    return []


def filter_image_paths(paths: List[str]) -> List[str]:
    if paths:
        return [path for path in paths if is_image(path)]
    return []


def resolve_relative_path(path: str) -> str:
    return os.path.abspath(os.path.join(os.path.dirname(__file__), path))


def list_directory(directory_path: str) -> Optional[List[str]]:
    if is_directory(directory_path):
        files = os.listdir(directory_path)
        files = [Path(file).stem for file in files if not Path(file).stem.startswith(('.', '__'))]
        return sorted(files)
    return None


def sanitize_path_for_windows(full_path: str) -> Optional[str]:
    buffer_size = 0

    while True:
        unicode_buffer = ctypes.create_unicode_buffer(buffer_size)
        buffer_threshold = ctypes.windll.kernel32.GetShortPathNameW(full_path, unicode_buffer, buffer_size)  # type:ignore[attr-defined]

        if buffer_size > buffer_threshold:
            return unicode_buffer.value
        if buffer_threshold == 0:
            return None
        buffer_size = buffer_threshold

然后关闭run.bat 从头驱动即可,若是惦记复制错了 

不错下载这个文献 然后阴事文献也不错

https://url24.ctfile.com/f/24666824-1315076998-5a8ea3?p=4440 (看望密码: 4440)

我使用的是facefusion 2.6.1 其他版块未作念测试

美女车模

不错去底下的地址 下载facefusion 2.6.1

https://www.jian27.com/html/835.html 乱伦qvod



Powered by 一路向西2之泰西 @2013-2022 RSS地图 HTML地图

Copyright Powered by站群 © 2013-2024