baguioni commited on
Commit
f7451c4
1 Parent(s): ffd5eab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -2,17 +2,8 @@ import gradio as gr
2
 
3
  model = gr.Interface.load("huggingface/pyannote/voice-activity-detection")
4
 
5
- #load input file and resample to 16kHz
6
- def load_data(path):
7
- speech, sampling_rate = librosa.load(path)
8
- if len(speech.shape) > 1:
9
- speech = speech[:,0] + speech[:,1]
10
- if sampling_rate != 16000:
11
- speech = librosa.resample(speech, sampling_rate,16000)
12
- return speech
13
-
14
- def inference(path):
15
- audio = load_data(path)
16
 
17
  inputs = gr.inputs.Audio(label="Input Audio", type="filepath", source="microphone")
18
  outputs = gr.outputs.Label(type="auto", label = "Voice timestamps")
@@ -20,7 +11,7 @@ title = "Voice Activity Detection"
20
  description = "Record or upload an audio file and detected human voices will be timestamped."
21
  article = "<a href = 'pyannote, https://github.com/pyannote/pyannote-audio"
22
 
23
- gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, theme="dark").launch(debug=True)
24
 
25
 
26
 
 
2
 
3
  model = gr.Interface.load("huggingface/pyannote/voice-activity-detection")
4
 
5
+ def inference(audio_file):
6
+ output = model(audio_file)
 
 
 
 
 
 
 
 
 
7
 
8
  inputs = gr.inputs.Audio(label="Input Audio", type="filepath", source="microphone")
9
  outputs = gr.outputs.Label(type="auto", label = "Voice timestamps")
 
11
  description = "Record or upload an audio file and detected human voices will be timestamped."
12
  article = "<a href = 'pyannote, https://github.com/pyannote/pyannote-audio"
13
 
14
+ gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, theme="grass").launch(debug=True)
15
 
16
 
17