HridayKharpude commited on
Commit
b10ee6b
ยท
1 Parent(s): 03c723c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -45,25 +45,26 @@ def config_audio(audio):
45
  print('exit2')
46
  return X_predict
47
 
48
- def predict_audio(Input_Audio, Playable_Audio):
49
- audio=Input_Audio.name
50
  print('enter1')
51
  X_predict = config_audio(audio)
52
  taals = ['addhatrital','bhajani','dadra','deepchandi','ektal','jhaptal','rupak','trital']
53
  pred = model.predict(X_predict).flatten()
54
  print('exit1')
55
- return {taals[i]: float(pred[i]) for i in range(7)}
56
 
57
  audio = gr.inputs.Audio(source="upload", optional=False)
58
  label = gr.outputs.Label()
59
 
 
 
 
60
  gr.Interface(predict_audio,
61
- ["file","audio"],
62
- outputs=label,
63
- description=""
64
-
65
- #examples = [["Addhatrital_Sample1.wav"], ["Addhatrital_Sample2.wav"], ["Bhajani_Sample1.wav"], ["Bhajani_Sample2.wav"],
66
- # ["Dadra_Sample1.wav"], ["Dadra_Sample2.wav"], ["Deepchandi_Sample1.wav"], ["Deepchandi_Sample2.wav"],
67
- # ["Ektal_Sample1.wav"], ["Ektal_Sample2.wav"], ["Jhaptal_Sample1.wav"], ["Jhaptal_Sample2.wav"],
68
- # ["Rupak_Sample1.wav"], ["Rupak_Sample2.wav"], ["Trital_Sample1.wav"], ["Trital_Sample2.wav"]]
69
- ).launch(debug=True)
 
45
  print('exit2')
46
  return X_predict
47
 
48
+ def predict_audio(audiox):
49
+ audio=audiox.name
50
  print('enter1')
51
  X_predict = config_audio(audio)
52
  taals = ['addhatrital','bhajani','dadra','deepchandi','ektal','jhaptal','rupak','trital']
53
  pred = model.predict(X_predict).flatten()
54
  print('exit1')
55
+ return {taals[i]: float(pred[i]) for i in range(7)},audio
56
 
57
  audio = gr.inputs.Audio(source="upload", optional=False)
58
  label = gr.outputs.Label()
59
 
60
+ audio = gr.inputs.Audio(source="upload", optional=False)
61
+ #label = gr.outputs.Label()
62
+
63
  gr.Interface(predict_audio,
64
+ ["file"],
65
+ [gr.outputs.Label(),gr.outputs.Audio()],
66
+ description=""
67
+ examples = [["Addhatrital_Sample1.wav"], ["Addhatrital_Sample2.wav"], ["Bhajani_Sample1.wav"], ["Bhajani_Sample2.wav"],
68
+ ["Dadra_Sample1.wav"], ["Dadra_Sample2.wav"], ["Deepchandi_Sample1.wav"], ["Deepchandi_Sample2.wav"],
69
+ ["Ektal_Sample1.wav"], ["Ektal_Sample2.wav"], ["Jhaptal_Sample1.wav"], ["Jhaptal_Sample2.wav"],
70
+ ["Rupak_Sample1.wav"], ["Rupak_Sample2.wav"], ["Trital_Sample1.wav"], ["Trital_Sample2.wav"]]).launch()