Spaces:
Paused
Paused
File size: 926 Bytes
45443ad cf83a20 45443ad 7af2f77 45443ad |
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 27 28 29 30 31 32 33 34 |
import gradio as gr
import whisperx
audio_model = whisperx.load_model('tiny', 'cpu', compute_type="float32")
def generate_answers(audio_q):
trans = audio_model.transcribe(audio_q)
audio_res = ""
for seg in trans['segments']:
audio_res += seg['text']
audio_res = audio_res.strip()
return audio_res
with gr.Blocks() as demo:
gr.Markdown(
"""# Testing wisper
"""
)
# app GUI
with gr.Row():
with gr.Column():
audio_q = gr.Audio(label="Audio Question", value=None, sources=['microphone', 'upload'], type='filepath',show_download_button=True)
with gr.Row():
answer = gr.Text(label ='Answer')
with gr.Row():
submit = gr.Button("Submit")
submit.click(generate_answers, inputs=[audio_q], outputs=[answer])
clear_btn = gr.ClearButton([audio_q, answer])
if __name__ == "__main__":
demo.launch(share=True) |