hysts HF staff commited on
Commit
bde2e64
1 Parent(s): a2c7d86
Files changed (1) hide show
  1. demo_list.py +13 -4
demo_list.py CHANGED
@@ -70,9 +70,11 @@ class DemoList:
70
  space_info = self.api.space_info(repo_id=space_id)
71
  card = space_info.cardData
72
  info = data[url]
 
73
  for tag in ['arxiv', 'github', 'tags']:
74
  if tag not in info:
75
  info[tag] = []
 
76
  info['url'] = url
77
  info['owner'] = space_id.split('/')[0]
78
  info['title'] = card['title']
@@ -81,14 +83,21 @@ class DemoList:
81
  info['likes'] = space_info.likes
82
  info['last_modified'] = space_info.lastModified
83
  info['status'] = space_info.runtime['stage']
84
- info['sleep_time'] = space_info.runtime['gcTimeout'] or -1
85
- resources = space_info.runtime['resources']
86
- info['replicas'] = -1 if resources is None else resources[
87
- 'replicas']
88
  info['suggested_hardware'] = card.get('suggested_hardware', '')
89
  info['hardware'] = space_info.runtime['hardware']['current']
90
  if info['hardware'] is None:
91
  info['hardware'] = space_info.runtime['hardware']['requested']
 
 
 
 
 
 
 
 
 
 
92
  res.append(info)
93
  return res
94
 
 
70
  space_info = self.api.space_info(repo_id=space_id)
71
  card = space_info.cardData
72
  info = data[url]
73
+
74
  for tag in ['arxiv', 'github', 'tags']:
75
  if tag not in info:
76
  info[tag] = []
77
+
78
  info['url'] = url
79
  info['owner'] = space_id.split('/')[0]
80
  info['title'] = card['title']
 
83
  info['likes'] = space_info.likes
84
  info['last_modified'] = space_info.lastModified
85
  info['status'] = space_info.runtime['stage']
86
+
 
 
 
87
  info['suggested_hardware'] = card.get('suggested_hardware', '')
88
  info['hardware'] = space_info.runtime['hardware']['current']
89
  if info['hardware'] is None:
90
  info['hardware'] = space_info.runtime['hardware']['requested']
91
+
92
+ if info['hardware'] == 'cpu-basic':
93
+ info['sleep_time'] = 172800
94
+ else:
95
+ info['sleep_time'] = space_info.runtime['gcTimeout'] or -1
96
+
97
+ resources = space_info.runtime['resources']
98
+ info['replicas'] = -1 if resources is None else resources[
99
+ 'replicas']
100
+
101
  res.append(info)
102
  return res
103