ironjr commited on
Commit
fc0f9d7
·
verified ·
1 Parent(s): 0e777fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -383,7 +383,7 @@ def register(state, drawpad, model):
383
  return state
384
 
385
 
386
- @spaces.GPU(duration=120)
387
  def run(state, drawpad):
388
  model.device = torch.device('cuda')
389
  model.reset_seed(model.generator, opt.seed)
@@ -412,10 +412,8 @@ def show_element():
412
  return gr.update(visible=True)
413
 
414
 
 
415
  def draw(state, drawpad):
416
- if not hasattr(state, 'model') or state.model is None:
417
- print('[WARNING] Model is not registered, update ignored.')
418
- return
419
  if not state.is_running:
420
  print('[WARNING] Streaming is currently off, update ignored.')
421
  return
@@ -444,7 +442,7 @@ def draw(state, drawpad):
444
  # mask_stds = [0] + [state.mask_stds[v] for v in has_masks]
445
 
446
  for i in range(len(has_masks)):
447
- state.model.update_single_layer(
448
  idx=i,
449
  mask=masks[i],
450
  mask_strength=mask_strengths[i],
 
383
  return state
384
 
385
 
386
+ @spaces.GPU(duration=(opt.prep_time + opt.run_time + 5))
387
  def run(state, drawpad):
388
  model.device = torch.device('cuda')
389
  model.reset_seed(model.generator, opt.seed)
 
412
  return gr.update(visible=True)
413
 
414
 
415
+ @spaces.GPU
416
  def draw(state, drawpad):
 
 
 
417
  if not state.is_running:
418
  print('[WARNING] Streaming is currently off, update ignored.')
419
  return
 
442
  # mask_stds = [0] + [state.mask_stds[v] for v in has_masks]
443
 
444
  for i in range(len(has_masks)):
445
+ model.update_single_layer(
446
  idx=i,
447
  mask=masks[i],
448
  mask_strength=mask_strengths[i],