admin commited on
Commit
08d296b
1 Parent(s): fa05e82

fix monitor pop

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -104,16 +104,16 @@ def get_spaces(username: str):
104
  response.raise_for_status()
105
  # 解析JSON响应
106
  spaces: list = response.json()["spaces"]
107
- studios = []
108
  for space in spaces:
109
  if space["author"] == username:
110
  url = f"https://{space['id'].replace('/', '-')}.hf.space"
111
  if "keep-spaces-active" in url:
112
- studios.insert(0, url)
113
  else:
114
  studios.append(url)
115
 
116
- return studios
117
 
118
  except requests.exceptions.Timeout as errt:
119
  print(f"请求超时: {errt}, retrying...")
 
104
  response.raise_for_status()
105
  # 解析JSON响应
106
  spaces: list = response.json()["spaces"]
107
+ monitors, studios = [], []
108
  for space in spaces:
109
  if space["author"] == username:
110
  url = f"https://{space['id'].replace('/', '-')}.hf.space"
111
  if "keep-spaces-active" in url:
112
+ monitors.append(url)
113
  else:
114
  studios.append(url)
115
 
116
+ return monitors + studios
117
 
118
  except requests.exceptions.Timeout as errt:
119
  print(f"请求超时: {errt}, retrying...")