Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,8 @@ def get_prompts(uploaded_image, track_duration, gen_intensity, gen_mode):
|
|
26 |
#prompt = img_to_text(uploaded_image, "ViT-L (best for Stable Diffusion 1.*)", "fast", fn_index=1)[0]
|
27 |
prompt = img_to_text(uploaded_image, 'fast', 4, fn_index=1)[0]
|
28 |
print(prompt)
|
29 |
-
|
|
|
30 |
print(music_result)
|
31 |
return music_result[0], gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
32 |
|
@@ -36,6 +37,23 @@ minilm = SentenceTransformer('all-MiniLM-L6-v2')
|
|
36 |
mubert_tags_embeddings = get_mubert_tags_embeddings(minilm)
|
37 |
|
38 |
def get_pat_token():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return pat
|
40 |
|
41 |
def get_track_by_tags(tags, pat, duration, gen_intensity, gen_mode, maxit=20):
|
|
|
26 |
#prompt = img_to_text(uploaded_image, "ViT-L (best for Stable Diffusion 1.*)", "fast", fn_index=1)[0]
|
27 |
prompt = img_to_text(uploaded_image, 'fast', 4, fn_index=1)[0]
|
28 |
print(prompt)
|
29 |
+
pat = get_pat_token()
|
30 |
+
music_result = generate_track_by_prompt(pat, prompt, track_duration, gen_intensity, gen_mode)
|
31 |
print(music_result)
|
32 |
return music_result[0], gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
33 |
|
|
|
37 |
mubert_tags_embeddings = get_mubert_tags_embeddings(minilm)
|
38 |
|
39 |
def get_pat_token():
|
40 |
+
r = httpx.post('https://api-b2b.mubert.com/v2/GetServiceAccess',
|
41 |
+
json={
|
42 |
+
"method": "GetServiceAccess",
|
43 |
+
"params": {
|
44 |
+
"email":"mail@mail.com",
|
45 |
+
"phone":"+11234567890",
|
46 |
+
"license": MUBERT_LICENSE,
|
47 |
+
"token": MUBERT_TOKEN,
|
48 |
+
"mode": MUBERT_MODE,
|
49 |
+
}
|
50 |
+
})
|
51 |
+
|
52 |
+
rdata = json.loads(r.text)
|
53 |
+
print(rdata)
|
54 |
+
#assert rdata['status'] == 1, "probably incorrect e-mail"
|
55 |
+
pat = rdata['data']['pat']
|
56 |
+
|
57 |
return pat
|
58 |
|
59 |
def get_track_by_tags(tags, pat, duration, gen_intensity, gen_mode, maxit=20):
|