PierreHanna commited on
Commit
9099754
1 Parent(s): 2839bc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -43,16 +43,13 @@ def process(input_path):
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']))
49
- print(themes)
50
-
51
-
52
- instruments = []
53
  for d in res['instruments']:
54
- instruments.append((d['name'],d['probability']))
55
- print(instruments)
56
 
57
  timbres = []
58
  for d in res['timbres']:
@@ -65,7 +62,7 @@ def process(input_path):
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,
@@ -92,11 +89,12 @@ with gr.Blocks() as demo:
92
 
93
  with gr.Row():
94
  dict_moods=gr.outputs.Label(label="Moods")
95
- dict_desc=gr.outputs.Label(label="Descriptors")
96
  genres = gr.outputs.Label(label="Genres")
 
97
 
98
 
99
- analyze_btn.click(process, inputs=[audio_input], outputs=[dict_moods, dict_desc, genres])
100
  #audio_input.submit(process, inputs=[audio_input], outputs=[moods]) # pas de sens !
101
 
102
  demo.launch(debug=False)
 
43
  for d in res['genres']:
44
  genres[d['name']] = d['probability']
45
 
46
+ themes = {}
47
  for d in res['themes']:
48
+ themes[d['name']]= d['probability']
49
+
50
+ instruments = {}
 
 
51
  for d in res['instruments']:
52
+ instruments[d['name']] = d['probability']
 
53
 
54
  timbres = []
55
  for d in res['timbres']:
 
62
  audioquality = [res['audio_quality'][0]['name'], res['audio_quality'][0]['probability']]
63
  print(audioquality)
64
 
65
+ return dict_moods, dict_desc, genres, instruments, themes
66
 
67
 
68
  demo = gr.Interface(fn=process,
 
89
 
90
  with gr.Row():
91
  dict_moods=gr.outputs.Label(label="Moods")
92
+ themes=gr.outputs.Label(label="Themes")
93
  genres = gr.outputs.Label(label="Genres")
94
+ instruments = gr.outputs.Label(label="Instruments")
95
 
96
 
97
+ analyze_btn.click(process, inputs=[audio_input], outputs=[dict_moods, dict_desc, genres, instruments, themes])
98
  #audio_input.submit(process, inputs=[audio_input], outputs=[moods]) # pas de sens !
99
 
100
  demo.launch(debug=False)