Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ def get_pat_token():
|
|
55 |
|
56 |
rdata = json.loads(r.text)
|
57 |
#print(rdata)
|
58 |
-
|
59 |
#pat = rdata['data']['pat']
|
60 |
print(rdata['data']['pat'])
|
61 |
return rdata['data']['pat']
|
@@ -76,15 +76,21 @@ def get_music(pat, prompt, track_duration, gen_intensity, gen_mode):
|
|
76 |
|
77 |
rdata = json.loads(r.text)
|
78 |
track=rdata['data']['tasks'][0]['download_link']
|
79 |
-
print(track)
|
80 |
-
assert rdata['status'] == 1,
|
81 |
#track = rdata['data']['tasks']['download_link']
|
82 |
|
83 |
-
|
84 |
time.sleep(2)
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
-
return str(track)
|
88 |
|
89 |
def get_track_by_tags(tags, pat, duration, gen_intensity, gen_mode, maxit=20):
|
90 |
|
|
|
55 |
|
56 |
rdata = json.loads(r.text)
|
57 |
#print(rdata)
|
58 |
+
assert rdata['status'] == 1, "probably incorrect e-mail"
|
59 |
#pat = rdata['data']['pat']
|
60 |
print(rdata['data']['pat'])
|
61 |
return rdata['data']['pat']
|
|
|
76 |
|
77 |
rdata = json.loads(r.text)
|
78 |
track=rdata['data']['tasks'][0]['download_link']
|
79 |
+
#print(track)
|
80 |
+
assert rdata['status'] == 1, rdata['error']['text']
|
81 |
#track = rdata['data']['tasks']['download_link']
|
82 |
|
83 |
+
print(rdata)
|
84 |
time.sleep(2)
|
85 |
|
86 |
+
print('Generating track ', end='')
|
87 |
+
for i in range(maxit):
|
88 |
+
r = httpx.get(track)
|
89 |
+
if r.status_code == 200:
|
90 |
+
return track
|
91 |
+
time.sleep(1)
|
92 |
+
|
93 |
|
|
|
94 |
|
95 |
def get_track_by_tags(tags, pat, duration, gen_intensity, gen_mode, maxit=20):
|
96 |
|