AudioValidation / app.py
Skriller0208's picture
Update app.py
baa78d9 verified
raw
history blame
1.1 kB
import streamlit as st
import time
from whisper_processor import process_audio
def process_audio_streamlit(audio_file, model_name, lang):
start_time = time.time()
result = process_audio(audio_file, model_name=model_name, lang=lang)
end_time = time.time()
elapsed_time = end_time - start_time
st.write("Time taken:", elapsed_time, "seconds")
return result
st.title("Audio Transcription")
# Upload audio file
uploaded_file = st.file_uploader("Choose an audio file")
# Select model and language
model_name = st.selectbox("Select model", ["tiny", "base", "small", "medium", "large"])
lang = st.selectbox("Select language", ["en", "hi", "fr", "de", "es", "it", "pt", "ru", "zh", "ja", "ko", "ar", "tr"])
if uploaded_file is not None:
# Save the uploaded file to a temporary location
with open("temp.wav", "wb") as f:
f.write(uploaded_file.read())
# Process the audio file
result = process_audio_streamlit("temp.wav", model_name, lang)
# Display the transcription result
st.write("Transcription:")
st.text_area("", value=result, height=300)