facefusion/facefusion/uis/layouts/default.py
Henry Ruhs 6e67d7bff6
2.4.1 (#442)
* Update official url for cuda 12-2 wheels

* Fix preview for audio to image

* Prevent download loop when remote is unreachable

* Prevent download loop when remote is unreachable

* changes (#444)

* Tidy up monkey patch

* Use cpu core count for concurrency count

* Dynamic concurrency_count for ideal Gradio performance

* Conditional download face analyser models

* Fix testing via pre_check()

* Introduce checking to process manager for blocking the UI

* Introduce checking to process manager for blocking the UI

* Introduce checking to process manager for blocking the UI

* Introduce checking to process manager for blocking the UI

* Move the blocking while model download to the correct position

* Remove unused imports

---------

Co-authored-by: Harisreedhar <46858047+harisreedhar@users.noreply.github.com>
2024-03-20 10:02:08 +01:00

81 lines
2.1 KiB
Python
Executable File

import multiprocessing
import gradio
from facefusion.uis.components import about, frame_processors, frame_processors_options, execution, execution_thread_count, execution_queue_count, memory, temp_frame, output_options, common_options, source, target, output, preview, trim_frame, face_analyser, face_selector, face_masker
def pre_check() -> bool:
return True
def pre_render() -> bool:
return True
def render() -> gradio.Blocks:
with gradio.Blocks() as layout:
with gradio.Row():
with gradio.Column(scale = 2):
with gradio.Blocks():
about.render()
with gradio.Blocks():
frame_processors.render()
with gradio.Blocks():
frame_processors_options.render()
with gradio.Blocks():
execution.render()
execution_thread_count.render()
execution_queue_count.render()
with gradio.Blocks():
memory.render()
with gradio.Blocks():
temp_frame.render()
with gradio.Blocks():
output_options.render()
with gradio.Column(scale = 2):
with gradio.Blocks():
source.render()
with gradio.Blocks():
target.render()
with gradio.Blocks():
output.render()
with gradio.Column(scale = 3):
with gradio.Blocks():
preview.render()
with gradio.Blocks():
trim_frame.render()
with gradio.Blocks():
face_selector.render()
with gradio.Blocks():
face_masker.render()
with gradio.Blocks():
face_analyser.render()
with gradio.Blocks():
common_options.render()
return layout
def listen() -> None:
frame_processors.listen()
frame_processors_options.listen()
execution.listen()
execution_thread_count.listen()
execution_queue_count.listen()
memory.listen()
temp_frame.listen()
output_options.listen()
source.listen()
target.listen()
output.listen()
preview.listen()
trim_frame.listen()
face_selector.listen()
face_masker.listen()
face_analyser.listen()
common_options.listen()
def run(ui : gradio.Blocks) -> None:
concurrency_count = min(8, multiprocessing.cpu_count())
ui.queue(concurrency_count = concurrency_count).launch(show_api = False, quiet = True)