Spaces:
Runtime error
Runtime error
import streamlit as st | |
import stable_whisper | |
import json | |
# Create a dropdown to select the model | |
model_name = st.selectbox("Select a model", ["base", "small", "medium", "large", "large-v2"]) | |
# Load the selected model | |
model = stable_whisper.load_model(model_name) | |
# Create a file uploader for the audio file | |
audiofile = st.file_uploader("Upload an audio file", type=["mp3", "wav"]) | |
# Create a button to run the prediction | |
if st.button('Transcribe'): | |
if audiofile is not None: | |
# Transcribe the audio file | |
result = model.transcribe(audiofile) | |
# Convert the result to JSON and display it | |
result_json = json.loads(result) | |
st.json(result_json) | |
else: | |
st.write("Please upload an audio file.") |