Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,9 @@ import gradio as gr
|
|
9 |
import numpy as np
|
10 |
from lxml.html import fromstring
|
11 |
from transformers import pipeline
|
12 |
-
from torch import
|
13 |
#from pathos.multiprocessing import ProcessPool as Pool
|
14 |
-
|
15 |
#from diffusers.pipelines.flux import FluxPipeline
|
16 |
#from diffusers.utils import export_to_gif
|
17 |
#from huggingface_hub import hf_hub_download
|
@@ -138,9 +138,10 @@ def main(p1,p2,*result):
|
|
138 |
ln = len(result)
|
139 |
rng = list(range(ln))
|
140 |
arr = [p for _ in rng]
|
141 |
-
|
|
|
142 |
out = pool.imap(infer,arr)
|
143 |
-
|
144 |
|
145 |
def infer(p):
|
146 |
p1 = p["a"]
|
|
|
9 |
import numpy as np
|
10 |
from lxml.html import fromstring
|
11 |
from transformers import pipeline
|
12 |
+
#from torch.multiprocessing import Pool
|
13 |
#from pathos.multiprocessing import ProcessPool as Pool
|
14 |
+
from pathos.threading import ThreadPool as Pool
|
15 |
#from diffusers.pipelines.flux import FluxPipeline
|
16 |
#from diffusers.utils import export_to_gif
|
17 |
#from huggingface_hub import hf_hub_download
|
|
|
138 |
ln = len(result)
|
139 |
rng = list(range(ln))
|
140 |
arr = [p for _ in rng]
|
141 |
+
out = None
|
142 |
+
with Pool(ln, initializer=init_pool) as pool:
|
143 |
out = pool.imap(infer,arr)
|
144 |
+
return list(out)
|
145 |
|
146 |
def infer(p):
|
147 |
p1 = p["a"]
|