Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,8 +34,7 @@ def parse_transcription(logits):
|
|
34 |
transcription = processor.decode(predicted_ids[0], skip_special_tokens=True)
|
35 |
return transcription
|
36 |
|
37 |
-
def transcribe(
|
38 |
-
audio_path = audio_microphone if audio_microphone else audio
|
39 |
speech_array, sampling_rate = torchaudio.load(audio_path)
|
40 |
speech = torchaudio.functional.resample(speech_array, orig_freq=sampling_rate, new_freq=16000).squeeze().numpy()
|
41 |
"""
|
@@ -64,8 +63,7 @@ gradio_ui = gr.Interface(
|
|
64 |
fn=transcribe,
|
65 |
title="Kikuyu Speech Recognition",
|
66 |
description="",
|
67 |
-
inputs=[gr.Audio(
|
68 |
-
gr.Audio(source="microphone", type="filepath", optional=True, label="Record from microphone"),
|
69 |
gr.Checkbox(label="Apply LM", value=False)],
|
70 |
outputs=[gr.outputs.Textbox(label="Recognized speech")]
|
71 |
)
|
|
|
34 |
transcription = processor.decode(predicted_ids[0], skip_special_tokens=True)
|
35 |
return transcription
|
36 |
|
37 |
+
def transcribe(audio_path, applyLM):
|
|
|
38 |
speech_array, sampling_rate = torchaudio.load(audio_path)
|
39 |
speech = torchaudio.functional.resample(speech_array, orig_freq=sampling_rate, new_freq=16000).squeeze().numpy()
|
40 |
"""
|
|
|
63 |
fn=transcribe,
|
64 |
title="Kikuyu Speech Recognition",
|
65 |
description="",
|
66 |
+
inputs=[gr.Audio(source="microphone", type="filepath", optional=True, label="Record from microphone"),
|
|
|
67 |
gr.Checkbox(label="Apply LM", value=False)],
|
68 |
outputs=[gr.outputs.Textbox(label="Recognized speech")]
|
69 |
)
|