sergioska commited on
Commit
525d1e9
·
1 Parent(s): 2e157cb

fix file name

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  # Load model directly
3
  from transformers import pipeline
 
4
 
5
  pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
6
 
@@ -8,5 +9,8 @@ st.title('Upload an audio file :blue[cool] :sunglasses:')
8
 
9
  uploaded_file = st.file_uploader("Choose a file")
10
  if uploaded_file is not None:
11
- result = pipe(uploaded_file.name)
12
- st.write(result)
 
 
 
 
1
  import streamlit as st
2
  # Load model directly
3
  from transformers import pipeline
4
+ from tempfile import NamedTemporaryFile
5
 
6
  pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
7
 
 
9
 
10
  uploaded_file = st.file_uploader("Choose a file")
11
  if uploaded_file is not None:
12
+ with NamedTemporaryFile(suffix="wav") as temp:
13
+ temp.write(uploaded_file.getvalue())
14
+ temp.seek(0)
15
+ result = pipe(temp.name)
16
+ st.write(result)