|
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) |
|
|