Copy Boss commited on
Commit
ffe71b0
1 Parent(s): 85b7ab5

Add application file

Browse files
Files changed (2) hide show
  1. app.py +23 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import stable_whisper
3
+ import json
4
+
5
+ # Create a dropdown to select the model
6
+ model_name = st.selectbox("Select a model", ["base", "small", "medium", "large", "large-v2"])
7
+
8
+ # Load the selected model
9
+ model = stable_whisper.load_model(model_name)
10
+
11
+ # Create a file uploader for the audio file
12
+ audiofile = st.file_uploader("Upload an audio file", type=["mp3", "wav"])
13
+
14
+ # Create a button to run the prediction
15
+ if st.button('Transcribe'):
16
+ if audiofile is not None:
17
+ # Transcribe the audio file
18
+ result = model.transcribe(audiofile)
19
+ # Convert the result to JSON and display it
20
+ result_json = json.loads(result)
21
+ st.json(result_json)
22
+ else:
23
+ st.write("Please upload an audio file.")
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ stable-ts