huzey commited on
Commit
5ff5029
1 Parent(s): e2011a5

handle gpu quota

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -997,16 +997,12 @@ def run_fn(
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
 
 
997
  except gr.Error as e:
998
  # I assume this is a GPU quota error
999
 
1000
+ info1 = '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></br>'
1001
+ 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>'
1002
+ info = info1 + info2
1003
+
1004
+ message = "HuggingFace: " + e.message + "</br></br>---------</br>" + "Developers: " + info
1005
+ raise gr.Error(message, duration=60)
 
 
 
 
1006
 
1007
 
1008