Upload face_fix.py
Browse files- face_fix.py +81 -0
face_fix.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import multiprocessing
|
| 2 |
+
import gradio
|
| 3 |
+
|
| 4 |
+
import facefusion.globals
|
| 5 |
+
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
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def pre_check() -> bool:
|
| 9 |
+
return True
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def pre_render() -> bool:
|
| 13 |
+
return True
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def render() -> gradio.Blocks:
|
| 17 |
+
with gradio.Blocks() as layout:
|
| 18 |
+
with gradio.Row():
|
| 19 |
+
with gradio.Column(scale = 2):
|
| 20 |
+
with gradio.Blocks():
|
| 21 |
+
about.render()
|
| 22 |
+
with gradio.Blocks():
|
| 23 |
+
frame_processors.render()
|
| 24 |
+
with gradio.Blocks():
|
| 25 |
+
frame_processors_options.render()
|
| 26 |
+
with gradio.Blocks():
|
| 27 |
+
execution.render()
|
| 28 |
+
execution_thread_count.render()
|
| 29 |
+
execution_queue_count.render()
|
| 30 |
+
with gradio.Blocks():
|
| 31 |
+
memory.render()
|
| 32 |
+
with gradio.Blocks():
|
| 33 |
+
temp_frame.render()
|
| 34 |
+
with gradio.Blocks():
|
| 35 |
+
output_options.render()
|
| 36 |
+
with gradio.Column(scale = 2):
|
| 37 |
+
with gradio.Blocks():
|
| 38 |
+
source.render()
|
| 39 |
+
with gradio.Blocks():
|
| 40 |
+
target.render()
|
| 41 |
+
with gradio.Blocks():
|
| 42 |
+
output.render()
|
| 43 |
+
with gradio.Column(scale = 3):
|
| 44 |
+
with gradio.Blocks():
|
| 45 |
+
preview.render()
|
| 46 |
+
with gradio.Blocks():
|
| 47 |
+
trim_frame.render()
|
| 48 |
+
with gradio.Blocks():
|
| 49 |
+
face_selector.render()
|
| 50 |
+
with gradio.Blocks():
|
| 51 |
+
face_masker.render()
|
| 52 |
+
with gradio.Blocks():
|
| 53 |
+
face_analyser.render()
|
| 54 |
+
with gradio.Blocks():
|
| 55 |
+
common_options.render()
|
| 56 |
+
return layout
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def listen() -> None:
|
| 60 |
+
frame_processors.listen()
|
| 61 |
+
frame_processors_options.listen()
|
| 62 |
+
execution.listen()
|
| 63 |
+
execution_thread_count.listen()
|
| 64 |
+
execution_queue_count.listen()
|
| 65 |
+
memory.listen()
|
| 66 |
+
temp_frame.listen()
|
| 67 |
+
output_options.listen()
|
| 68 |
+
source.listen()
|
| 69 |
+
target.listen()
|
| 70 |
+
output.listen()
|
| 71 |
+
preview.listen()
|
| 72 |
+
trim_frame.listen()
|
| 73 |
+
face_selector.listen()
|
| 74 |
+
face_masker.listen()
|
| 75 |
+
face_analyser.listen()
|
| 76 |
+
common_options.listen()
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def run(ui : gradio.Blocks) -> None:
|
| 80 |
+
concurrency_count = min(8, multiprocessing.cpu_count())
|
| 81 |
+
ui.queue(concurrency_count = concurrency_count).launch(show_api = False, quiet = True, inbrowser = facefusion.globals.open_browser, share=True)
|