Spaces:
Runtime error
Runtime error
Commit
·
50c1ac4
1
Parent(s):
127c67b
Update app.py
Browse files
app.py
CHANGED
@@ -27,12 +27,12 @@ def download_audio(id_video):
|
|
27 |
def process_url(input_path):
|
28 |
# setup the client
|
29 |
audio_file, audio_file, embed_html_all = download_audio(input_path)
|
30 |
-
return
|
31 |
|
32 |
def process_file(input_path):
|
33 |
-
return
|
34 |
|
35 |
-
def process(audio_file):
|
36 |
client = SimbalsAPIClient(os.environ['TOKEN'], debug=True)
|
37 |
parameters = client.prepare_request("31415", audio_file=audio_file)
|
38 |
|
@@ -98,8 +98,8 @@ def process(audio_file):
|
|
98 |
audioquality = {}
|
99 |
audioquality[res['audio_quality'][0]['name']]= res['audio_quality'][0]['probability']
|
100 |
|
101 |
-
|
102 |
-
return dict_moods, genres, instruments, vocalgender, timbres, themes, audioquality,str(dict_desc['Electric/Acoustic']),str(dict_desc['Danceability']),str(dict_desc['Arousal']),str(dict_desc['Vocal/Instrumental']),str(dict_desc['Studio/Live']),str(dict_desc['Music/Speech']),str(dict_desc['Valence']),str(dict_desc['Melodic']),str(dict_desc['Articulation']),str(dict_desc['RhythmicStability']),str(dict_desc['Dissonance']),str(dict_desc['BPM']),str(dict_desc['Binary']),str(dict_desc['Key']),str(dict_desc['Mode']),str(dict_desc['TexturalStability'])
|
103 |
|
104 |
|
105 |
|
@@ -115,7 +115,7 @@ with gr.Blocks() as demo:
|
|
115 |
|
116 |
with gr.Row():
|
117 |
with gr.Column():
|
118 |
-
|
119 |
analyze_url_btn = gr.Button('Analyze URL')
|
120 |
|
121 |
with gr.Row():
|
@@ -182,7 +182,7 @@ with gr.Blocks() as demo:
|
|
182 |
themes=gr.Label(label="Themes", show_label=False)
|
183 |
'''
|
184 |
|
185 |
-
analyze_url_btn.click(process, inputs=[
|
186 |
outputs=[html,
|
187 |
dict_moods,
|
188 |
genres,
|
@@ -209,7 +209,7 @@ with gr.Blocks() as demo:
|
|
209 |
texturalstability
|
210 |
])
|
211 |
|
212 |
-
analyze_file_btn.click(process_file, inputs=[
|
213 |
outputs=[html,
|
214 |
dict_moods,
|
215 |
genres,
|
|
|
27 |
def process_url(input_path):
|
28 |
# setup the client
|
29 |
audio_file, audio_file, embed_html_all = download_audio(input_path)
|
30 |
+
return process(audio_file, embed_html_all)
|
31 |
|
32 |
def process_file(input_path):
|
33 |
+
return process(input_path, '')
|
34 |
|
35 |
+
def process(audio_file, enmbed_html_all):
|
36 |
client = SimbalsAPIClient(os.environ['TOKEN'], debug=True)
|
37 |
parameters = client.prepare_request("31415", audio_file=audio_file)
|
38 |
|
|
|
98 |
audioquality = {}
|
99 |
audioquality[res['audio_quality'][0]['name']]= res['audio_quality'][0]['probability']
|
100 |
|
101 |
+
return embed_html_all, dict_moods, genres, instruments, vocalgender, timbres, themes, audioquality,str(dict_desc['Electric/Acoustic']),str(dict_desc['Danceability']),str(dict_desc['Arousal']),str(dict_desc['Vocal/Instrumental']),str(dict_desc['Studio/Live']),str(dict_desc['Music/Speech']),str(dict_desc['Valence']),str(dict_desc['Melodic']),str(dict_desc['Articulation']),str(dict_desc['RhythmicStability']),str(dict_desc['Dissonance']),str(dict_desc['BPM']),str(dict_desc['Binary']),str(dict_desc['Key']),str(dict_desc['Mode']),str(dict_desc['TexturalStability'])
|
102 |
+
#return dict_moods, genres, instruments, vocalgender, timbres, themes, audioquality,str(dict_desc['Electric/Acoustic']),str(dict_desc['Danceability']),str(dict_desc['Arousal']),str(dict_desc['Vocal/Instrumental']),str(dict_desc['Studio/Live']),str(dict_desc['Music/Speech']),str(dict_desc['Valence']),str(dict_desc['Melodic']),str(dict_desc['Articulation']),str(dict_desc['RhythmicStability']),str(dict_desc['Dissonance']),str(dict_desc['BPM']),str(dict_desc['Binary']),str(dict_desc['Key']),str(dict_desc['Mode']),str(dict_desc['TexturalStability'])
|
103 |
|
104 |
|
105 |
|
|
|
115 |
|
116 |
with gr.Row():
|
117 |
with gr.Column():
|
118 |
+
audio_url_input = gr.Textbox(placeholder='YouTube video URL', label='YouTube video URL')
|
119 |
analyze_url_btn = gr.Button('Analyze URL')
|
120 |
|
121 |
with gr.Row():
|
|
|
182 |
themes=gr.Label(label="Themes", show_label=False)
|
183 |
'''
|
184 |
|
185 |
+
analyze_url_btn.click(process, inputs=[audio_url_input],
|
186 |
outputs=[html,
|
187 |
dict_moods,
|
188 |
genres,
|
|
|
209 |
texturalstability
|
210 |
])
|
211 |
|
212 |
+
analyze_file_btn.click(process_file, inputs=[audio_input_file],
|
213 |
outputs=[html,
|
214 |
dict_moods,
|
215 |
genres,
|