Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def get_prompts(uploaded_image, track_duration, gen_intensity, gen_mode):
|
|
30 |
music_result = get_music(pat, prompt, track_duration, gen_intensity, gen_mode)
|
31 |
#music_result = generate_track_by_prompt(pat, prompt, track_duration, gen_intensity, gen_mode)
|
32 |
print(music_result)
|
33 |
-
return music_result
|
34 |
|
35 |
from utils import get_tags_for_prompts, get_mubert_tags_embeddings, get_pat
|
36 |
|
@@ -54,11 +54,30 @@ def get_pat_token():
|
|
54 |
print(rdata)
|
55 |
#assert rdata['status'] == 1, "probably incorrect e-mail"
|
56 |
pat = rdata['data']['pat']
|
57 |
-
|
58 |
return pat
|
59 |
|
60 |
def get_music(pat, prompt, track_duration, gen_intensity, gen_mode):
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
return track
|
63 |
|
64 |
def get_track_by_tags(tags, pat, duration, gen_intensity, gen_mode, maxit=20):
|
|
|
30 |
music_result = get_music(pat, prompt, track_duration, gen_intensity, gen_mode)
|
31 |
#music_result = generate_track_by_prompt(pat, prompt, track_duration, gen_intensity, gen_mode)
|
32 |
print(music_result)
|
33 |
+
return music_result, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
34 |
|
35 |
from utils import get_tags_for_prompts, get_mubert_tags_embeddings, get_pat
|
36 |
|
|
|
54 |
print(rdata)
|
55 |
#assert rdata['status'] == 1, "probably incorrect e-mail"
|
56 |
pat = rdata['data']['pat']
|
57 |
+
print(pat)
|
58 |
return pat
|
59 |
|
60 |
def get_music(pat, prompt, track_duration, gen_intensity, gen_mode):
|
61 |
|
62 |
+
r = httpx.post('https://api-b2b.mubert.com/v2/GetServiceAccess',
|
63 |
+
json={
|
64 |
+
"method": "TTMRecordTrack",
|
65 |
+
"params":
|
66 |
+
{
|
67 |
+
"text":prompt,
|
68 |
+
"pat":pat,
|
69 |
+
"mode":"track",
|
70 |
+
"duration":track_duration,
|
71 |
+
"bitrate":"192"
|
72 |
+
}
|
73 |
+
})
|
74 |
+
|
75 |
+
rdata = json.loads(r.text)
|
76 |
+
print(rdata)
|
77 |
+
#assert rdata['status'] == 1, "probably incorrect e-mail"
|
78 |
+
track = rdata['data']['tasks']['download_link']
|
79 |
+
|
80 |
+
print(track)
|
81 |
return track
|
82 |
|
83 |
def get_track_by_tags(tags, pat, duration, gen_intensity, gen_mode, maxit=20):
|