mirror of
https://github.com/facefusion/facefusion.git
synced 2026-11-12 05:19:57 +01:00
check processor in stream manager
This commit is contained in:
1 parent
cebdd05fb8
commit
f08f24fb62
3 files changed
+14
-9
No files matched your search
@@ -15,12 +15,14 @@ from facefusion.apis.stream_audio import receive_audio_frames, send_audio_frames
|
||||
from facefusion.apis.stream_video import receive_video_frames, send_video_frames
|
||||
from facefusion.content_analyser import analyse_frame
|
||||
from facefusion.libraries import datachannel as datachannel_module
|
||||
from facefusion.processors.core import processors_pre_check
|
||||
from facefusion.types import AudioCodec, AudioFrame, BufferPack, PeerConnection, RtcPeer, RtcPeerAudio, SdpAnswer, SdpOffer, Time, VideoCodec, VisionFrame
|
||||
from facefusion.vision import from_buffer, is_vision_frame, obscure_frame, read_static_images, to_buffer
|
||||
|
||||
|
||||
async def process_image(websocket : WebSocket) -> None:
|
||||
process_manager.start()
|
||||
await asyncio.to_thread(processors_pre_check)
|
||||
|
||||
async for capture_vision_frame in receive_vision_frames(websocket):
|
||||
source_vision_frames = read_static_images(state_manager.get_item('source_paths'))
|
||||
@@ -124,6 +126,8 @@ def process_video(rtc_peer : RtcPeer) -> None:
|
||||
video_executor = thread_helper.create_executor(execution_thread_count)
|
||||
|
||||
process_manager.start()
|
||||
processors_pre_check()
|
||||
|
||||
video_receiver_thread = threading.Thread(
|
||||
target = copy_context().run,
|
||||
args = (receive_video_frames, rtc_peer.get('video'), video_queue, video_executor),
|
||||
|
||||
+1
-8
@@ -14,7 +14,7 @@ from facefusion.filesystem import get_file_extension
|
||||
from facefusion.filesystem import get_file_name, resolve_file_paths, resolve_file_pattern
|
||||
from facefusion.jobs import job_helper, job_manager, job_runner
|
||||
from facefusion.jobs.job_list import compose_job_list
|
||||
from facefusion.processors.core import get_processors_modules
|
||||
from facefusion.processors.core import get_processors_modules, processors_pre_check
|
||||
from facefusion.program import create_program
|
||||
from facefusion.program_helper import validate_args
|
||||
from facefusion.types import Args, ErrorCode, JobId, StepIndex
|
||||
@@ -118,13 +118,6 @@ def common_pre_check() -> bool:
|
||||
return hash_helper.create_hash(content_analyser_content) == 'c39e7c00' and hash_helper.create_hash(content_store_content) == '77e47f71'
|
||||
|
||||
|
||||
def processors_pre_check() -> bool:
|
||||
for processor_module in get_processors_modules(state_manager.get_item('processors')):
|
||||
if not processor_module.pre_check():
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def force_download() -> ErrorCode:
|
||||
download_scope = state_manager.get_item('download_scope')
|
||||
available_processors = [ get_file_name(file_path) for file_path in resolve_file_paths('facefusion/processors/modules') ]
|
||||
|
||||
@@ -2,7 +2,7 @@ import importlib
|
||||
from types import ModuleType
|
||||
from typing import Any, List
|
||||
|
||||
from facefusion import logger, translator
|
||||
from facefusion import logger, state_manager, translator
|
||||
from facefusion.exit_helper import hard_exit
|
||||
|
||||
|
||||
@@ -43,3 +43,11 @@ def get_processors_modules(processors : List[str]) -> List[ModuleType]:
|
||||
processor_module = load_processor_module(processor)
|
||||
processor_modules.append(processor_module)
|
||||
return processor_modules
|
||||
|
||||
|
||||
def processors_pre_check() -> bool:
|
||||
for processor_module in get_processors_modules(state_manager.get_item('processors')):
|
||||
if not processor_module.pre_check():
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in new issue
Block a user