linux test
This commit is contained in:
parent
fa2ea648db
commit
5f12e7efd9
|
@ -1,6 +1,6 @@
|
||||||
import os.path
|
import os.path
|
||||||
from concurrent.futures import ProcessPoolExecutor
|
from concurrent.futures import ProcessPoolExecutor
|
||||||
|
from multiprocessing import get_context
|
||||||
|
|
||||||
|
|
||||||
def _load_tf_and_return_tags(pil_image, threshold):
|
def _load_tf_and_return_tags(pil_image, threshold):
|
||||||
|
@ -66,7 +66,8 @@ def subprocess_init_no_cuda():
|
||||||
|
|
||||||
|
|
||||||
def get_deepbooru_tags(pil_image, threshold=0.5):
|
def get_deepbooru_tags(pil_image, threshold=0.5):
|
||||||
with ProcessPoolExecutor(initializer=subprocess_init_no_cuda) as executor:
|
context = get_context('spawn')
|
||||||
|
with ProcessPoolExecutor(initializer=subprocess_init_no_cuda, mp_context=context) as executor:
|
||||||
f = executor.submit(_load_tf_and_return_tags, pil_image, threshold, )
|
f = executor.submit(_load_tf_and_return_tags, pil_image, threshold, )
|
||||||
ret = f.result() # will rethrow any exceptions
|
ret = f.result() # will rethrow any exceptions
|
||||||
return ret
|
return ret
|
Loading…
Reference in New Issue