Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -190,17 +190,15 @@ 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 _ret(idx):
|
194 |
-
p1
|
195 |
-
p2 = prompt2.value
|
196 |
-
print(f'Starting {idx}: {result[idx]} {p1} {p2}')
|
197 |
v = infer(p1,p2)
|
198 |
print(f'Finished {idx}: {v}')
|
199 |
-
|
200 |
-
def _rets():
|
201 |
ln = len(result)
|
202 |
-
idxs = list(range(ln))
|
203 |
-
Pool(ln).imap( _ret, idxs )
|
204 |
-
run_button.click(fn=_rets)
|
205 |
|
206 |
demo.queue().launch()
|
|
|
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,p1,p2):
|
194 |
+
print(f'Starting {idx}: {p1} {p2}')
|
|
|
|
|
195 |
v = infer(p1,p2)
|
196 |
print(f'Finished {idx}: {v}')
|
197 |
+
return v
|
198 |
+
def _rets(p1,p2):
|
199 |
ln = len(result)
|
200 |
+
idxs = [ [idx,p1,p2] for idx in list(range(ln)) ]
|
201 |
+
return Pool(ln).imap( _ret, idxs ).get()
|
202 |
+
run_button.click(fn=_rets,inputs=[prompt,prompt2],outputs=result)
|
203 |
|
204 |
demo.queue().launch()
|