Spaces:
Running
on
Zero
Running
on
Zero
handle gpu quota
Browse files
app.py
CHANGED
@@ -962,6 +962,7 @@ def run_fn(
|
|
962 |
# print(kwargs)
|
963 |
|
964 |
try:
|
|
|
965 |
|
966 |
if old_school_ncut:
|
967 |
return super_duper_long_run(model, images, **kwargs)
|
@@ -994,14 +995,18 @@ def run_fn(
|
|
994 |
return quick_run(model, images, **kwargs)
|
995 |
|
996 |
except gr.Error as e:
|
997 |
-
|
998 |
-
gr.Warning(e.message)
|
999 |
-
if USE_HUGGINGFACE_ZEROGPU:
|
1000 |
-
spaces.zero.gradio.HTMLError(e.message)
|
1001 |
-
gr.Warning("Error: " + e.message)
|
1002 |
-
gr.Warning("Error: " + str(e))
|
1003 |
-
gr.Info("Running out of HuggingFace GPU Quota? Try this demo hosted at UPenn.</br></br> https://ncut-pytorch.readthedocs.io/en/latest/demo/", duration=20)
|
1004 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1005 |
|
1006 |
|
1007 |
|
|
|
962 |
# print(kwargs)
|
963 |
|
964 |
try:
|
965 |
+
# try to aquiare GPU, can fail if the user is out of GPU quota
|
966 |
|
967 |
if old_school_ncut:
|
968 |
return super_duper_long_run(model, images, **kwargs)
|
|
|
995 |
return quick_run(model, images, **kwargs)
|
996 |
|
997 |
except gr.Error as e:
|
998 |
+
# I assume this is a GPU quota error
|
|
|
|
|
|
|
|
|
|
|
|
|
999 |
|
1000 |
+
# print(e)
|
1001 |
+
# gr.Warning(e.message)
|
1002 |
+
# if USE_HUGGINGFACE_ZEROGPU:
|
1003 |
+
# spaces.zero.gradio.HTMLError(e.message)
|
1004 |
+
# gr.Warning("Error: " + e.message)
|
1005 |
+
# gr.Warning("Error: " + str(e))
|
1006 |
+
info = 'Running out of HuggingFace GPU Quota? 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>'
|
1007 |
+
# gr.Info(info, duration=20)
|
1008 |
+
message = e.message + "</br></br>---</br>" + info
|
1009 |
+
raise gr.Error(message, duration=20)
|
1010 |
|
1011 |
|
1012 |
|