Icaro Bombonato commited on
Commit
ccf1139
1 Parent(s): 4bebc03

add sensitivy to silence

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -84,9 +84,9 @@ def get_audio_plot(filename, chunks):
84
  return plt.gcf()
85
 
86
 
87
- def get_audio_info(audio):
88
  new_audio = convert_to_wav(audio)
89
- ts, chunks = get_chunk_times(new_audio, 30, 1)
90
  p = get_audio_plot(new_audio, chunks)
91
  return str(ts), p
92
 
@@ -95,10 +95,11 @@ otext = gr.outputs.Textbox(type="auto", label="Silence time:")
95
  oplot = gr.outputs.Image(type="plot", label="Audio with silence in gray areas")
96
 
97
  iaudio = gr.inputs.Audio(source="upload", type="filepath", label=None)
 
98
 
99
  iface = gr.Interface(
100
  get_audio_info,
101
- iaudio,
102
  [otext, oplot],
103
  description="Enter audio to view silence areas",
104
  )
 
84
  return plt.gcf()
85
 
86
 
87
+ def get_audio_info(audio, treshold):
88
  new_audio = convert_to_wav(audio)
89
+ ts, chunks = get_chunk_times(new_audio, treshold, 1)
90
  p = get_audio_plot(new_audio, chunks)
91
  return str(ts), p
92
 
 
95
  oplot = gr.outputs.Image(type="plot", label="Audio with silence in gray areas")
96
 
97
  iaudio = gr.inputs.Audio(source="upload", type="filepath", label=None)
98
+ isensitivity = gr.inputs.Slider(minimum=0, maximum=50, step=1, default=25, label="Silence sensitivity")
99
 
100
  iface = gr.Interface(
101
  get_audio_info,
102
+ [iaudio, isensitivity],
103
  [otext, oplot],
104
  description="Enter audio to view silence areas",
105
  )