Spaces:
Sleeping
Sleeping
LVKinyanjui
commited on
Commit
β’
d5eba79
1
Parent(s):
d7d7ec2
Wrote a fix for audio file upload parse errors
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
st.write("## Whisper Speech to Text π§")
|
4 |
|
@@ -36,10 +37,15 @@ def transcribe(_pipe, sample):
|
|
36 |
return result["text"]
|
37 |
|
38 |
|
39 |
-
|
40 |
|
41 |
model = load_model()
|
42 |
if st.button("Transcribe"):
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from tempfile import NamedTemporaryFile
|
3 |
|
4 |
st.write("## Whisper Speech to Text π§")
|
5 |
|
|
|
37 |
return result["text"]
|
38 |
|
39 |
|
40 |
+
audio = st.file_uploader("Upload your Audio Here")
|
41 |
|
42 |
model = load_model()
|
43 |
if st.button("Transcribe"):
|
44 |
+
if audio is not None:
|
45 |
+
st.write("Transcribing ... ")
|
46 |
+
|
47 |
+
with NamedTemporaryFile(suffix="mp3") as temp:
|
48 |
+
temp.write(audio.getvalue())
|
49 |
+
temp.seek(0)
|
50 |
+
transcript = transcribe(model, temp.name)
|
51 |
+
transcript # MAGIC!
|