Spaces:
Runtime error
Runtime error
Commit ·
812d7ec
1
Parent(s): 28b55f2
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,23 +31,18 @@ def process(input_path):
|
|
| 31 |
|
| 32 |
res = results[1]["response"]["tagging"]["2"]
|
| 33 |
|
| 34 |
-
|
| 35 |
-
moods = []
|
| 36 |
for m in res['moods']:
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
music_desc=[]
|
| 42 |
for d in res['music_descriptors']:
|
| 43 |
-
|
| 44 |
-
print(music_desc)
|
| 45 |
|
| 46 |
-
genres=
|
| 47 |
for d in res['genres']:
|
| 48 |
-
genres
|
| 49 |
-
|
| 50 |
-
|
| 51 |
themes = []
|
| 52 |
for d in res['themes']:
|
| 53 |
themes.append((d['name'],d['probability']))
|
|
@@ -70,7 +65,7 @@ def process(input_path):
|
|
| 70 |
audioquality = [res['audio_quality'][0]['name'], res['audio_quality'][0]['probability']]
|
| 71 |
print(audioquality)
|
| 72 |
|
| 73 |
-
return
|
| 74 |
|
| 75 |
|
| 76 |
demo = gr.Interface(fn=process,
|
|
@@ -96,11 +91,11 @@ with gr.Blocks() as demo:
|
|
| 96 |
analyze_btn = gr.Button('Analyze File')
|
| 97 |
|
| 98 |
with gr.Row():
|
| 99 |
-
|
| 100 |
moods=gr.outputs.Label(label="Moods")
|
| 101 |
|
| 102 |
|
| 103 |
-
analyze_btn.click(process, inputs=[audio_input], outputs=[
|
| 104 |
#audio_input.submit(process, inputs=[audio_input], outputs=[moods]) # pas de sens !
|
| 105 |
|
| 106 |
demo.launch(debug=False)
|
|
|
|
| 31 |
|
| 32 |
res = results[1]["response"]["tagging"]["2"]
|
| 33 |
|
| 34 |
+
dict_moods = {}
|
|
|
|
| 35 |
for m in res['moods']:
|
| 36 |
+
dict_moods[m['name']] = m['probability']
|
| 37 |
+
|
| 38 |
+
dict_desc={}
|
|
|
|
|
|
|
| 39 |
for d in res['music_descriptors']:
|
| 40 |
+
dict_desc[d['name']] = d['value']
|
|
|
|
| 41 |
|
| 42 |
+
genres={}
|
| 43 |
for d in res['genres']:
|
| 44 |
+
genres[d['name']] = d['probability']
|
| 45 |
+
|
|
|
|
| 46 |
themes = []
|
| 47 |
for d in res['themes']:
|
| 48 |
themes.append((d['name'],d['probability']))
|
|
|
|
| 65 |
audioquality = [res['audio_quality'][0]['name'], res['audio_quality'][0]['probability']]
|
| 66 |
print(audioquality)
|
| 67 |
|
| 68 |
+
return dict_moods, dict_desc, genres
|
| 69 |
|
| 70 |
|
| 71 |
demo = gr.Interface(fn=process,
|
|
|
|
| 91 |
analyze_btn = gr.Button('Analyze File')
|
| 92 |
|
| 93 |
with gr.Row():
|
| 94 |
+
moods=gr.outputs.Label(label="Moods")
|
| 95 |
moods=gr.outputs.Label(label="Moods")
|
| 96 |
|
| 97 |
|
| 98 |
+
analyze_btn.click(process, inputs=[audio_input], outputs=[dict_moods, dict_desc, genres])
|
| 99 |
#audio_input.submit(process, inputs=[audio_input], outputs=[moods]) # pas de sens !
|
| 100 |
|
| 101 |
demo.launch(debug=False)
|