File size: 596 Bytes
25152ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import torch
import streamlit as st
import numpy as np
from PIL import Image, ImageDraw
from transformers import pipeline
from tempfile import NamedTemporaryFile
audiopipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")st.title('Upload an audio file for speech recognition')
uploaded_audio_file = st.file_uploader("Choose an audio file (wav)")
if uploaded_audio_file is not None:
with NamedTemporaryFile(suffix="wav") as temp:
temp.write(uploaded_audio_file.getvalue())
temp.seek(0)
result = audiopipe(temp.name)
st.write(result)
|