Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,18 +38,12 @@ def youtube_video_downloader(url):
|
|
| 38 |
def audio_extraction(video_file):
|
| 39 |
# video_file_bytes = os.fsencode(video_file)
|
| 40 |
# audio = extract_audio(input_path=video_file_bytes, output_path=f"{video_file}.mp3")
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
# Extract the audio from the video
|
| 44 |
-
audio = video.audio
|
| 45 |
-
|
| 46 |
-
# Write the audio to a file
|
| 47 |
-
audio_path = 'audio.mp3'
|
| 48 |
-
audio.write_audiofile(audio_path)
|
| 49 |
-
|
| 50 |
-
# Close the video file
|
| 51 |
-
video.close()
|
| 52 |
return audio_path
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
def audio_processing(mp3_audio):
|
|
@@ -113,7 +107,7 @@ with file_select_tab:
|
|
| 113 |
if st.button("Transcribe", key="vidfile"):
|
| 114 |
with st.spinner("Transcribing..."):
|
| 115 |
audio = audio_extraction(video_file)
|
| 116 |
-
audio = audio_processing(audio)
|
| 117 |
video_transcript = transcriber_pass(audio)
|
| 118 |
st.success(f"Transcription successful")
|
| 119 |
st.write(video_transcript)
|
|
|
|
| 38 |
def audio_extraction(video_file):
|
| 39 |
# video_file_bytes = os.fsencode(video_file)
|
| 40 |
# audio = extract_audio(input_path=video_file_bytes, output_path=f"{video_file}.mp3")
|
| 41 |
+
audio = AudioSegment.from_file(video_file, 'mp4')
|
| 42 |
+
audio_path = 'audio.wav'
|
| 43 |
+
audio.export(audio_path, format="wav")
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
return audio_path
|
| 46 |
+
|
| 47 |
|
| 48 |
|
| 49 |
def audio_processing(mp3_audio):
|
|
|
|
| 107 |
if st.button("Transcribe", key="vidfile"):
|
| 108 |
with st.spinner("Transcribing..."):
|
| 109 |
audio = audio_extraction(video_file)
|
| 110 |
+
# audio = audio_processing(audio)
|
| 111 |
video_transcript = transcriber_pass(audio)
|
| 112 |
st.success(f"Transcription successful")
|
| 113 |
st.write(video_transcript)
|