File size: 831 Bytes
0896895 a6556aa 0896895 5a2cdd8 0896895 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
import soundfile as sf
from faster_whisper import WhisperModel
model = WhisperModel("tiny", device="cpu", compute_type="int8")
def transcribe_audio(audio):
sr, data = audio
temp_file = "temp.wav"
sf.write(temp_file, data, sr, format='wav')
segments, info = model.transcribe(temp_file)
result = ""
for segment in segments:
result += "[%.2fs -> %.2fs] %s\n" % (segment.start, segment.end, segment.text)
return result
iface = gr.Interface(
fn=transcribe_audio,
inputs=["microphone"],
outputs=gr.Textbox(),
title="Team UNDERGOD SIF Hackathon Audio to Text Demo (Press Submit Again if it shows Error!)",
description="This Demo Shows our state of the art solution for Psuedo real-time audio transcription (Only English Accepted)"
)
iface.launch(debug=True)
|