Spaces:
Running
Running
admin
commited on
Commit
•
6c61bf1
1
Parent(s):
7d11fa9
fix hf activate
Browse files
app.py
CHANGED
@@ -28,11 +28,8 @@ def start_monitor(url: str):
|
|
28 |
}
|
29 |
response = requests.post(f"{url}/queue/join?", json=payload)
|
30 |
# 检查请求是否成功
|
31 |
-
if response.status_code
|
32 |
-
print("
|
33 |
-
return response.text
|
34 |
-
|
35 |
-
return None
|
36 |
|
37 |
|
38 |
def add_six_hours(match):
|
@@ -108,7 +105,7 @@ def get_spaces(username: str):
|
|
108 |
studios = []
|
109 |
for space in spaces:
|
110 |
if space["author"] == username:
|
111 |
-
studios.append(f"https://{
|
112 |
|
113 |
return studios
|
114 |
|
@@ -174,8 +171,8 @@ def activate(hf_users: str, ms_users: str):
|
|
174 |
time.sleep(DELAY)
|
175 |
|
176 |
output = []
|
177 |
-
for
|
178 |
-
output.append({"space":
|
179 |
time.sleep(DELAY)
|
180 |
|
181 |
print("Activation complete!")
|
|
|
28 |
}
|
29 |
response = requests.post(f"{url}/queue/join?", json=payload)
|
30 |
# 检查请求是否成功
|
31 |
+
if response.status_code != 200:
|
32 |
+
print("请求失败")
|
|
|
|
|
|
|
33 |
|
34 |
|
35 |
def add_six_hours(match):
|
|
|
105 |
studios = []
|
106 |
for space in spaces:
|
107 |
if space["author"] == username:
|
108 |
+
studios.append(f"https://{space['id'].replace('/', '-')}.hf.space")
|
109 |
|
110 |
return studios
|
111 |
|
|
|
171 |
time.sleep(DELAY)
|
172 |
|
173 |
output = []
|
174 |
+
for space in tqdm(spaces, desc="Activating spaces..."):
|
175 |
+
output.append({"space": space, "status": activate_space(space)})
|
176 |
time.sleep(DELAY)
|
177 |
|
178 |
print("Activation complete!")
|