Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,10 @@ def main_function(audio):
|
|
15 |
'file': open('test.wav', 'rb'),
|
16 |
}
|
17 |
result = requests.post('https://api.audd.io/', data=data, files=files)
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
print("--------------------------------")
|
22 |
print(result.json()['result']['artist'])
|
23 |
print("--------------------------------")
|
@@ -27,7 +28,7 @@ def main_function(audio):
|
|
27 |
print("--------------------------------")
|
28 |
print(result.json()['result']['spotify']['album']['images'][0]['url'])
|
29 |
print("--------------------------------")
|
30 |
-
return artist, title, genre
|
31 |
|
32 |
def reverse_audio(audio):
|
33 |
sr, data = audio
|
@@ -48,7 +49,8 @@ demo = gr.Interface(
|
|
48 |
outputs=[
|
49 |
gr.Textbox(label="Artist", show_copy_button=True),
|
50 |
gr.Textbox(label="Music", show_copy_button=True),
|
51 |
-
gr.Textbox(label="Genre", show_copy_button=True)
|
|
|
52 |
]
|
53 |
)
|
54 |
|
|
|
15 |
'file': open('test.wav', 'rb'),
|
16 |
}
|
17 |
result = requests.post('https://api.audd.io/', data=data, files=files)
|
18 |
+
artist = result.json()['result']['artist']
|
19 |
+
title = result.json()['result']['title']
|
20 |
+
genre = result.json()['result']['apple_music']['genreNames']
|
21 |
+
image_url = result.json()['result']['spotify']['album']['images'][0]['url']
|
22 |
print("--------------------------------")
|
23 |
print(result.json()['result']['artist'])
|
24 |
print("--------------------------------")
|
|
|
28 |
print("--------------------------------")
|
29 |
print(result.json()['result']['spotify']['album']['images'][0]['url'])
|
30 |
print("--------------------------------")
|
31 |
+
return artist, title, genre, image_url
|
32 |
|
33 |
def reverse_audio(audio):
|
34 |
sr, data = audio
|
|
|
49 |
outputs=[
|
50 |
gr.Textbox(label="Artist", show_copy_button=True),
|
51 |
gr.Textbox(label="Music", show_copy_button=True),
|
52 |
+
gr.Textbox(label="Genre", show_copy_button=True),
|
53 |
+
gr.Image()
|
54 |
]
|
55 |
)
|
56 |
|