mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2024-12-25 07:21:13 -08:00
61472cdaf7
removed support of extracted(aligned) PNG faces. Use old builds to convert from PNG to JPG. fanseg model file in facelib/ is renamed
26 lines
772 B
Python
26 lines
772 B
Python
import multiprocessing
|
|
from core.interact import interact as io
|
|
|
|
class MPFunc():
|
|
def __init__(self, func):
|
|
self.func = func
|
|
|
|
self.s2c = multiprocessing.Queue()
|
|
self.c2s = multiprocessing.Queue()
|
|
self.lock = multiprocessing.Lock()
|
|
|
|
io.add_process_messages_callback(self.io_callback)
|
|
|
|
def io_callback(self):
|
|
while not self.c2s.empty():
|
|
func_args, func_kwargs = self.c2s.get()
|
|
self.s2c.put ( self.func (*func_args, **func_kwargs) )
|
|
|
|
def __call__(self, *args, **kwargs):
|
|
with self.lock:
|
|
self.c2s.put ( (args, kwargs) )
|
|
return self.s2c.get()
|
|
|
|
def __getstate__(self):
|
|
return {'s2c':self.s2c, 'c2s':self.c2s, 'lock':self.lock}
|