huzey commited on
Commit
bbff064
1 Parent(s): b8bf004

update run time

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -901,6 +901,10 @@ if USE_HUGGINGFACE_ZEROGPU:
901
  def longer_run(*args, **kwargs):
902
  return _ncut_run(*args, **kwargs)
903
 
 
 
 
 
904
  @spaces.GPU(duration=120)
905
  def super_duper_long_run(*args, **kwargs):
906
  return _ncut_run(*args, **kwargs)
@@ -1244,13 +1248,15 @@ def run_fn(
1244
  return super_duper_long_run(model, images, **kwargs)
1245
 
1246
  num_images = len(images)
1247
- if num_images >= 100:
1248
  return super_duper_long_run(model, images, **kwargs)
1249
  if 'diffusion' in model_name.lower():
1250
  return super_duper_long_run(model, images, **kwargs)
1251
  if recursion:
1252
  return longer_run(model, images, **kwargs)
1253
- if num_images >= 50:
 
 
1254
  return longer_run(model, images, **kwargs)
1255
  if old_school_ncut:
1256
  return longer_run(model, images, **kwargs)
@@ -1270,7 +1276,7 @@ def run_fn(
1270
  except gr.Error as e:
1271
  # I assume this is a GPU quota error
1272
 
1273
- info1 = 'Running out of HuggingFace GPU Quota?</br> Please try <a style="white-space: nowrap;text-underline-offset: 2px;color: var(--body-text-color)" href="https://ncut-pytorch.readthedocs.io/en/latest/demo/">Demo hosted at UPenn</a></br>'
1274
  info2 = 'Or try use the Python package that powers this app: <a style="white-space: nowrap;text-underline-offset: 2px;color: var(--body-text-color)" href="https://ncut-pytorch.readthedocs.io/en/latest/">ncut-pytorch</a>'
1275
  info = info1 + info2
1276
 
 
901
  def longer_run(*args, **kwargs):
902
  return _ncut_run(*args, **kwargs)
903
 
904
+ @spaces.GPU(duration=90)
905
+ def quite_long_run(*args, **kwargs):
906
+ return _ncut_run(*args, **kwargs)
907
+
908
  @spaces.GPU(duration=120)
909
  def super_duper_long_run(*args, **kwargs):
910
  return _ncut_run(*args, **kwargs)
 
1248
  return super_duper_long_run(model, images, **kwargs)
1249
 
1250
  num_images = len(images)
1251
+ if num_images > 100:
1252
  return super_duper_long_run(model, images, **kwargs)
1253
  if 'diffusion' in model_name.lower():
1254
  return super_duper_long_run(model, images, **kwargs)
1255
  if recursion:
1256
  return longer_run(model, images, **kwargs)
1257
+ if num_images > 50:
1258
+ return quite_long_run(model, images, **kwargs)
1259
+ if num_images > 30:
1260
  return longer_run(model, images, **kwargs)
1261
  if old_school_ncut:
1262
  return longer_run(model, images, **kwargs)
 
1276
  except gr.Error as e:
1277
  # I assume this is a GPU quota error
1278
 
1279
+ info1 = 'Running out of HuggingFace GPU Quota?</br> Please try <a style="white-space: nowrap;text-underline-offset: 2px;color: var(--body-text-color)" href="https://ncut-pytorch.readthedocs.io/en/latest/demo/">Demo hosted at UPenn</a>, passcode is: `158.130.50.41`</br>'
1280
  info2 = 'Or try use the Python package that powers this app: <a style="white-space: nowrap;text-underline-offset: 2px;color: var(--body-text-color)" href="https://ncut-pytorch.readthedocs.io/en/latest/">ncut-pytorch</a>'
1281
  info = info1 + info2
1282