Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import numpy as np
|
|
10 |
from lxml.html import fromstring
|
11 |
from diffusers import AutoPipelineForText2Image
|
12 |
#from tempfile import NamedTemporaryFile
|
13 |
-
from pathos.multiprocessing import
|
14 |
|
15 |
#model_id = "runwayml/stable-diffusion-v1-5"
|
16 |
#model_id = "kandinsky-community/kandinsky-3"
|
@@ -190,10 +190,12 @@ with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
|
|
190 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
191 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
192 |
|
193 |
-
def
|
194 |
result[idx] = infer(prompt,prompt2)
|
195 |
-
def
|
196 |
-
|
197 |
-
|
|
|
|
|
198 |
|
199 |
demo.queue().launch()
|
|
|
10 |
from lxml.html import fromstring
|
11 |
from diffusers import AutoPipelineForText2Image
|
12 |
#from tempfile import NamedTemporaryFile
|
13 |
+
from pathos.multiprocessing import ThreadPool as Pool
|
14 |
|
15 |
#model_id = "runwayml/stable-diffusion-v1-5"
|
16 |
#model_id = "kandinsky-community/kandinsky-3"
|
|
|
190 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
191 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
192 |
|
193 |
+
def _ret(idx):
|
194 |
result[idx] = infer(prompt,prompt2)
|
195 |
+
def _rets():
|
196 |
+
ln = len(result)
|
197 |
+
idxs = list(range(ln))
|
198 |
+
Pool(ln).amap( _ret, idxs )
|
199 |
+
run_button.click(_rets)
|
200 |
|
201 |
demo.queue().launch()
|