Junr-syl's picture
Update app.py
24d98ad
raw
history blame
498 Bytes
import torch
from transformers import pipeline
import streamlit as st
from st_audiorec import st_audiorec
@st.cache_resource
def make_text(audio):
pipe=pipeline("automatic-speech-recognition","distil-whisper/distil-large-v2")
text= pipe(audio)
extract_text=text['text']
return extract_text
st.title('speech recognition')
wave_audio_data=st_audiorec()
if wave_audio_data is not None:
text=make_text(wave_audio_data)
st.write(text)
else:
st.error('No Audio data')