tensorkelechi commited on
Commit
f46450e
1 Parent(s): fdec55c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,5 +1,4 @@
1
  import streamlit as st
2
- from moviepy.editor import VideoFileClip
3
  import time
4
  from transformers import pipeline
5
  from pytube import YouTube
@@ -38,7 +37,7 @@ 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
- audio = AudioSegment.from_file(video_file, 'mp4')
42
  audio_path = 'audio.wav'
43
  audio.export(audio_path, format="wav")
44
 
@@ -102,11 +101,11 @@ with file_select_tab:
102
 
103
 
104
  if uploaded_video_file:
105
- video_file = uploaded_video_file.read()
106
 
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")
 
1
  import streamlit as st
 
2
  import time
3
  from transformers import pipeline
4
  from pytube import YouTube
 
37
  def audio_extraction(video_file):
38
  # video_file_bytes = os.fsencode(video_file)
39
  # audio = extract_audio(input_path=video_file_bytes, output_path=f"{video_file}.mp3")
40
+ audio = AudioSegment.from_file(video_file, format="mp4")
41
  audio_path = 'audio.wav'
42
  audio.export(audio_path, format="wav")
43
 
 
101
 
102
 
103
  if uploaded_video_file:
104
+ video_file = uploaded_video_file
105
 
106
  if st.button("Transcribe", key="vidfile"):
107
  with st.spinner("Transcribing..."):
108
+ audio = audio_extraction(uploaded_video_file)
109
  # audio = audio_processing(audio)
110
  video_transcript = transcriber_pass(audio)
111
  st.success(f"Transcription successful")