Spaces:
Running
Running
P01yH3dr0n
commited on
Commit
•
0b5b7f3
1
Parent(s):
1114eaa
get anlas error handle
Browse files
utils.py
CHANGED
@@ -27,9 +27,12 @@ def set_token(token):
|
|
27 |
}
|
28 |
|
29 |
def get_remain_anlas():
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
def calculate_cost(width, height, steps, sm, dyn, strength=1, rmbg=False):
|
35 |
pixels = width * height
|
|
|
27 |
}
|
28 |
|
29 |
def get_remain_anlas():
|
30 |
+
try:
|
31 |
+
data = requests.get("https://api.novelai.net/user/data", headers=headers).content
|
32 |
+
anlas = json.loads(data)['subscription']['trainingStepsLeft']
|
33 |
+
return anlas['fixedTrainingStepsLeft'] + anlas['purchasedTrainingSteps']
|
34 |
+
except:
|
35 |
+
return '获取失败,err:' + str(data)
|
36 |
|
37 |
def calculate_cost(width, height, steps, sm, dyn, strength=1, rmbg=False):
|
38 |
pixels = width * height
|