ironjr commited on
Commit
da56a9e
1 Parent(s): 88cd42c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -407,15 +407,16 @@ def run(state, drawpad):
407
  tic = time.time()
408
  while True:
409
  # Receive real-time mask inputs from the main process.
410
- msg = conn.recv()
411
- print(msg + ' Received!!!')
412
- # for i in range(opt.max_palettes):
413
- # model.update_single_layer(
414
- # idx=i,
415
- # mask=masks[i],
416
- # mask_strength=mask_strengths[i],
417
- # mask_std=mask_stds[i],
418
- # )
 
419
 
420
  yield [state, model()]
421
  toc = time.time()
@@ -472,7 +473,12 @@ def draw(state, drawpad):
472
  # mask_strength=mask_strengths[i],
473
  # mask_std=mask_stds[i],
474
  # )
475
- conn.send('Hello!!!!')
 
 
 
 
 
476
  conn.close()
477
 
478
  ### Load examples
 
407
  tic = time.time()
408
  while True:
409
  # Receive real-time mask inputs from the main process.
410
+ data = conn.recv()
411
+ if data is not None:
412
+ print('Received data!!!')
413
+ for i in range(opt.max_palettes):
414
+ model.update_single_layer(
415
+ idx=i,
416
+ mask=data['masks'][i],
417
+ mask_strength=data['mask_strengths'][i],
418
+ mask_std=data['mask_stds'][i],
419
+ )
420
 
421
  yield [state, model()]
422
  toc = time.time()
 
473
  # mask_strength=mask_strengths[i],
474
  # mask_std=mask_stds[i],
475
  # )
476
+ data = dict(
477
+ masks=masks,
478
+ mask_strengths=mask_strengths,
479
+ mask_stds=mask_stds,
480
+ )
481
+ conn.send(data)
482
  conn.close()
483
 
484
  ### Load examples