Spaces:
Running
Running
more cinditions
Browse files
app.py
CHANGED
@@ -1,22 +1,27 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
|
5 |
st.title("Speech to Text")
|
6 |
|
7 |
-
|
8 |
-
audio_file = st.file_uploader("Upload an audio file", type=["wav", "mp3", "ogg", "m4a"])
|
9 |
|
10 |
|
11 |
|
12 |
if audio_file:
|
13 |
-
#
|
14 |
-
|
|
|
15 |
|
16 |
-
text = transcriber(
|
17 |
if text:
|
18 |
st.write("Here is the text:")
|
19 |
st.write(text)
|
|
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
|
|
|
1 |
import streamlit as st
|
2 |
+
import pydub as pd
|
3 |
from transformers import pipeline
|
4 |
|
5 |
|
6 |
st.title("Speech to Text")
|
7 |
|
8 |
+
audio_file = st.file_uploader("Upload an audio file")
|
|
|
9 |
|
10 |
|
11 |
|
12 |
if audio_file:
|
13 |
+
# to flac
|
14 |
+
flac_file = pd.AudioSegment.from_file(audio_file)
|
15 |
+
transcriber = pipeline(model="openai/whisper-medium")
|
16 |
|
17 |
+
text = transcriber(flac_file)
|
18 |
if text:
|
19 |
st.write("Here is the text:")
|
20 |
st.write(text)
|
21 |
+
else:
|
22 |
+
st.write("Processing or No text found in the audio file")
|
23 |
+
else:
|
24 |
+
st.write("waiting for file")
|
25 |
|
26 |
|
27 |
|