Spaces:
Paused
Paused
| 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) |