Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -241,6 +241,11 @@ class Command:
|
|
241 |
self.data = data
|
242 |
|
243 |
def parallel(*pairs):
|
|
|
|
|
|
|
|
|
|
|
244 |
async def async_main(queue):
|
245 |
while True:
|
246 |
command = await queue.get()
|
@@ -362,10 +367,10 @@ def handle(*inp):
|
|
362 |
inp[1] = array(inp[1])
|
363 |
inp[2] = array(inp[2])
|
364 |
inp[3] = array(inp[3])
|
365 |
-
|
366 |
-
|
|
|
367 |
for i in range(ln):
|
368 |
-
out_pipe[i] = calc(*inp)
|
369 |
name = generate_random_string(12)+".png"
|
370 |
export_to_gif(out_pipe[i].frames[0],name,fps=fps)
|
371 |
out_pipe[i] = name
|
|
|
241 |
self.data = data
|
242 |
|
243 |
def parallel(*pairs):
|
244 |
+
if len(pairs) == 0:
|
245 |
+
return
|
246 |
+
if len(pairs) == 1:
|
247 |
+
pairs = pairs[0]
|
248 |
+
|
249 |
async def async_main(queue):
|
250 |
while True:
|
251 |
command = await queue.get()
|
|
|
367 |
inp[1] = array(inp[1])
|
368 |
inp[2] = array(inp[2])
|
369 |
inp[3] = array(inp[3])
|
370 |
+
|
371 |
+
parargs = [[calc,*inp] for i in range(ln)]
|
372 |
+
out_pipe = parallel(parargs)
|
373 |
for i in range(ln):
|
|
|
374 |
name = generate_random_string(12)+".png"
|
375 |
export_to_gif(out_pipe[i].frames[0],name,fps=fps)
|
376 |
out_pipe[i] = name
|