beeguy commited on
Commit
0d3902f
·
1 Parent(s): 606e097

more cinditions

Browse files
Files changed (1) hide show
  1. app.py +10 -5
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
- transcriber = pipeline(model="openai/whisper-large-v2")
8
- audio_file = st.file_uploader("Upload an audio file", type=["wav", "mp3", "ogg", "m4a"])
9
 
10
 
11
 
12
  if audio_file:
13
- # convert audio file m4a to wav
14
- # audio_file = convert_audio(audio_file)
 
15
 
16
- text = transcriber(audio_file)
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