huzey commited on
Commit
1efccb8
1 Parent(s): 51d0dee

cpu for ncut

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -304,7 +304,7 @@ def ncut_run(
304
  affinity_focal_gamma=affinity_focal_gamma,
305
  knn_ncut=1,
306
  knn_tsne=10,
307
- num_sample_tsne=500,
308
  embedding_method=embedding_method,
309
  perplexity=perplexity,
310
  n_neighbors=n_neighbors,
@@ -381,6 +381,9 @@ if USE_HUGGINGFACE_ZEROGPU:
381
  @spaces.GPU(duration=120)
382
  def super_duper_long_run(*args, **kwargs):
383
  return _ncut_run(*args, **kwargs)
 
 
 
384
 
385
  if not USE_HUGGINGFACE_ZEROGPU:
386
  def quick_run(*args, **kwargs):
@@ -394,6 +397,9 @@ if not USE_HUGGINGFACE_ZEROGPU:
394
 
395
  def super_duper_long_run(*args, **kwargs):
396
  return _ncut_run(*args, **kwargs)
 
 
 
397
 
398
  def extract_video_frames(video_path, max_frames=100):
399
  from decord import VideoReader
@@ -524,6 +530,10 @@ def run_fn(
524
  "video_output": video_output,
525
  }
526
  # print(kwargs)
 
 
 
 
527
  num_images = len(images)
528
  if num_images >= 100:
529
  return super_duper_long_run(model, images, **kwargs)
 
304
  affinity_focal_gamma=affinity_focal_gamma,
305
  knn_ncut=1,
306
  knn_tsne=10,
307
+ num_sample_tsne=300,
308
  embedding_method=embedding_method,
309
  perplexity=perplexity,
310
  n_neighbors=n_neighbors,
 
381
  @spaces.GPU(duration=120)
382
  def super_duper_long_run(*args, **kwargs):
383
  return _ncut_run(*args, **kwargs)
384
+
385
+ def cpu_run(*args, **kwargs):
386
+ return _ncut_run(*args, **kwargs)
387
 
388
  if not USE_HUGGINGFACE_ZEROGPU:
389
  def quick_run(*args, **kwargs):
 
397
 
398
  def super_duper_long_run(*args, **kwargs):
399
  return _ncut_run(*args, **kwargs)
400
+
401
+ def cpu_run(*args, **kwargs):
402
+ return _ncut_run(*args, **kwargs)
403
 
404
  def extract_video_frames(video_path, max_frames=100):
405
  from decord import VideoReader
 
530
  "video_output": video_output,
531
  }
532
  # print(kwargs)
533
+
534
+ if old_school_ncut:
535
+ cpu_run(model, images, **kwargs)
536
+
537
  num_images = len(images)
538
  if num_images >= 100:
539
  return super_duper_long_run(model, images, **kwargs)