Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import numpy as np
|
2 |
-
import gradio as gr
|
3 |
import requests
|
4 |
import os
|
5 |
from scipy.io.wavfile import write
|
@@ -19,40 +18,24 @@ def main_function(audio):
|
|
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("--------------------------------")
|
25 |
-
print(result.json()['result']['title'])
|
26 |
-
print("--------------------------------")
|
27 |
-
print(result.json()['result']['apple_music']['genreNames'])
|
28 |
-
print("--------------------------------")
|
29 |
-
print(result.json()['result']['spotify']['album']['images'][0]['url'])
|
30 |
-
print("--------------------------------")
|
31 |
return artist, title, genre, image_url
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
sources=["upload", "microphone"],
|
39 |
-
waveform_options=gr.WaveformOptions(
|
40 |
-
waveform_color="#01C6FF",
|
41 |
-
waveform_progress_color="#0066B4",
|
42 |
-
skip_length=2,
|
43 |
-
show_controls=False,
|
44 |
-
),
|
45 |
-
)
|
46 |
-
demo = gr.Interface(
|
47 |
-
fn=main_function,
|
48 |
-
inputs=input_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(label="Cover")
|
54 |
-
]
|
55 |
-
)
|
56 |
-
|
57 |
-
if __name__ == "__main__":
|
58 |
-
demo.launch()
|
|
|
1 |
import numpy as np
|
|
|
2 |
import requests
|
3 |
import os
|
4 |
from scipy.io.wavfile import write
|
|
|
18 |
title = result.json()['result']['title']
|
19 |
genre = result.json()['result']['apple_music']['genreNames']
|
20 |
image_url = result.json()['result']['spotify']['album']['images'][0]['url']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
return artist, title, genre, image_url
|
22 |
|
23 |
+
with gr.Blocks() as demo:
|
24 |
+
with gr.Row():
|
25 |
+
audio_input = gr.Audio(
|
26 |
+
sources=["upload", "microphone"],
|
27 |
+
waveform_options=gr.WaveformOptions(
|
28 |
+
waveform_color="#01C6FF",
|
29 |
+
waveform_progress_color="#0066B4",
|
30 |
+
skip_length=2,
|
31 |
+
show_controls=False,
|
32 |
+
),
|
33 |
+
)
|
34 |
+
with gr.Row():
|
35 |
+
artist_output = gr.Textbox(label="Artist", show_copy_button=True)
|
36 |
+
title_output = gr.Textbox(label="Music", show_copy_button=True)
|
37 |
+
genre_output = gr.Textbox(label="Genre", show_copy_button=True)
|
38 |
+
with gr.Row():
|
39 |
+
image_output = gr.Image(label="Cover")
|
40 |
|
41 |
+
demo.launch(inputs=audio_input, outputs=[artist_output, title_output, genre_output, image_output])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|