multimodalart HF staff commited on
Commit
f1ea2a6
1 Parent(s): af17881

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -182,7 +182,11 @@ def get_sleep_time(hf_token):
182
  sleep_time_url = f"https://huggingface.co/api/spaces/{os.environ['SPACE_ID']}"
183
  headers = { "authorization" : f"Bearer {hf_token}"}
184
  response = requests.get(sleep_time_url,headers=headers)
185
- return response.json()['runtime']['gcTimeout']
 
 
 
 
186
 
187
  def write_to_community(title, description,hf_token):
188
  from huggingface_hub import HfApi
 
182
  sleep_time_url = f"https://huggingface.co/api/spaces/{os.environ['SPACE_ID']}"
183
  headers = { "authorization" : f"Bearer {hf_token}"}
184
  response = requests.get(sleep_time_url,headers=headers)
185
+ try:
186
+ gcTimeout = response.json()['runtime']['gcTimeout']
187
+ except:
188
+ gcTimeout = None
189
+ return gcTimeout
190
 
191
  def write_to_community(title, description,hf_token):
192
  from huggingface_hub import HfApi