huzey commited on
Commit
c43f5e7
1 Parent(s): 27a746c

handle gpu quota

Browse files
Files changed (1) hide show
  1. app.py +32 -30
app.py CHANGED
@@ -961,41 +961,43 @@ def run_fn(
961
  }
962
  # print(kwargs)
963
 
964
- try:
965
 
966
- if old_school_ncut:
967
- return super_duper_long_run(model, images, **kwargs)
968
-
969
- if is_lisa:
970
- return super_duper_long_run(model, images, **kwargs)
971
-
972
- num_images = len(images)
973
- if num_images >= 100:
974
- return super_duper_long_run(model, images, **kwargs)
975
- if 'diffusion' in model_name.lower():
976
- return super_duper_long_run(model, images, **kwargs)
977
- if recursion:
978
- return longer_run(model, images, **kwargs)
979
- if num_images >= 50:
980
- return longer_run(model, images, **kwargs)
981
- if old_school_ncut:
 
 
 
 
 
982
  return longer_run(model, images, **kwargs)
983
- if num_images >= 10:
984
- return long_run(model, images, **kwargs)
985
- if embedding_method == "UMAP":
986
- if perplexity >= 250 or num_sample_tsne >= 500:
987
- return longer_run(model, images, **kwargs)
988
  return long_run(model, images, **kwargs)
989
- if embedding_method == "t-SNE":
990
- if perplexity >= 250 or num_sample_tsne >= 500:
991
- return long_run(model, images, **kwargs)
992
- return quick_run(model, images, **kwargs)
993
-
994
  return quick_run(model, images, **kwargs)
995
 
996
- except Exception as e:
997
- gr.Error(str(e))
998
- gr.Info("Running out of GPU Quota? Try this demo hosted at UPenn.\n https://ncut-pytorch.readthedocs.io/en/latest/demo/")
 
 
 
 
999
 
1000
 
1001
 
 
961
  }
962
  # print(kwargs)
963
 
964
+ # try:
965
 
966
+ if old_school_ncut:
967
+ return super_duper_long_run(model, images, **kwargs)
968
+
969
+ if is_lisa:
970
+ return super_duper_long_run(model, images, **kwargs)
971
+
972
+ num_images = len(images)
973
+ if num_images >= 100:
974
+ return super_duper_long_run(model, images, **kwargs)
975
+ if 'diffusion' in model_name.lower():
976
+ return super_duper_long_run(model, images, **kwargs)
977
+ if recursion:
978
+ return longer_run(model, images, **kwargs)
979
+ if num_images >= 50:
980
+ return longer_run(model, images, **kwargs)
981
+ if old_school_ncut:
982
+ return longer_run(model, images, **kwargs)
983
+ if num_images >= 10:
984
+ return long_run(model, images, **kwargs)
985
+ if embedding_method == "UMAP":
986
+ if perplexity >= 250 or num_sample_tsne >= 500:
987
  return longer_run(model, images, **kwargs)
988
+ return long_run(model, images, **kwargs)
989
+ if embedding_method == "t-SNE":
990
+ if perplexity >= 250 or num_sample_tsne >= 500:
 
 
991
  return long_run(model, images, **kwargs)
 
 
 
 
 
992
  return quick_run(model, images, **kwargs)
993
 
994
+ return quick_run(model, images, **kwargs)
995
+
996
+ # except spaces.GPUError as e:
997
+ # print(e)
998
+ # gr.Error(str(e))
999
+ # gr.Info("Running out of GPU Quota? Try this demo hosted at UPenn.\n https://ncut-pytorch.readthedocs.io/en/latest/demo/")
1000
+
1001
 
1002
 
1003