Spaces:
Runtime error
Runtime error
Commit
·
69963ba
1
Parent(s):
c8434cb
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,17 +16,19 @@ st.markdown("---",unsafe_allow_html=True)
|
|
| 16 |
audio=st.file_uploader("Upload Your Audio File", type=['mp3','wav','m4a'])
|
| 17 |
|
| 18 |
if audio:
|
| 19 |
-
|
| 20 |
pipe = pipeline(model="facebook/wav2vec2-base-960h")
|
|
|
|
|
|
|
|
|
|
| 21 |
# stride_length_s is a tuple of the left and right stride length.
|
| 22 |
# With only 1 number, both sides get the same stride, by default
|
| 23 |
# the stride_length on one side is 1/6th of the chunk_length_s
|
| 24 |
|
| 25 |
# chunk.export(str(index)+".wav", format="wav")
|
| 26 |
-
audio_segment= AudioSegment.from_file(audio)
|
| 27 |
-
|
| 28 |
-
for index, chunk in enumerate (chunks):
|
| 29 |
-
#output = pipe(audio_segment, chunk_length_s=10, stride_length_s=(4, 2))
|
| 30 |
-
print (chunk)
|
| 31 |
-
st.json("wav")
|
| 32 |
|
|
|
|
| 16 |
audio=st.file_uploader("Upload Your Audio File", type=['mp3','wav','m4a'])
|
| 17 |
|
| 18 |
if audio:
|
|
|
|
| 19 |
pipe = pipeline(model="facebook/wav2vec2-base-960h")
|
| 20 |
+
audio.export("audio.wav", format="wav")
|
| 21 |
+
output = pipe("audio.wav", chunk_length_s=10, stride_length_s=(4, 2))
|
| 22 |
+
st.json(output)
|
| 23 |
# stride_length_s is a tuple of the left and right stride length.
|
| 24 |
# With only 1 number, both sides get the same stride, by default
|
| 25 |
# the stride_length on one side is 1/6th of the chunk_length_s
|
| 26 |
|
| 27 |
# chunk.export(str(index)+".wav", format="wav")
|
| 28 |
+
# audio_segment= AudioSegment.from_file(audio)
|
| 29 |
+
# chunks=silence.split_on_silence(audio_segment, min_silence_len=500, silence_thresh= audio_segment.dBFS-20,keep_silence=100)
|
| 30 |
+
# for index, chunk in enumerate (chunks):
|
| 31 |
+
# #output = pipe(audio_segment, chunk_length_s=10, stride_length_s=(4, 2))
|
| 32 |
+
# print (chunk)
|
| 33 |
+
# st.json("wav")
|
| 34 |
|