Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def audio_extraction(video_file, output_format):
|
|
34 |
# temp_filename = video_file.name
|
35 |
# video_path = f"{temp_filename}"
|
36 |
audio = extract_audio(
|
37 |
-
input_path=os.fspath(video_file), output_path=f"{str(video_file)[:-4]
|
38 |
)
|
39 |
return audio
|
40 |
|
@@ -51,9 +51,9 @@ def load_asr_model():
|
|
51 |
asr_model = pipeline(task="automatic-speech-recognition", model="openai/whisper-large-v3")
|
52 |
return asr_model
|
53 |
|
54 |
-
def transcribe_video(
|
55 |
transcriber_model = load_asr_model()
|
56 |
-
text_extract = transcriber_model(
|
57 |
return text_extract['text']
|
58 |
|
59 |
def generate_ai_summary(transcript):
|
@@ -76,7 +76,8 @@ with youtube_url_tab:
|
|
76 |
if url:
|
77 |
if st.button("Transcribe", key="yturl"):
|
78 |
with st.spinner("Transcribing..."):
|
79 |
-
audio = audio_extraction(yt_video, "
|
|
|
80 |
ytvideo_transcript = transcribe_video(audio)
|
81 |
st.success(f"Transcription successful")
|
82 |
st.write(ytvideo_transcript)
|
@@ -98,6 +99,7 @@ with file_select_tab:
|
|
98 |
if st.button("Transcribe", key="vidfile"):
|
99 |
with st.spinner("Transcribing..."):
|
100 |
audio = audio_extraction(os.fspath(video_file), "mp3")
|
|
|
101 |
video_transcript = transcribe_video(audio)
|
102 |
st.success(f"Transcription successful")
|
103 |
st.write(video_transcript)
|
|
|
34 |
# temp_filename = video_file.name
|
35 |
# video_path = f"{temp_filename}"
|
36 |
audio = extract_audio(
|
37 |
+
input_path=os.fspath(video_file), output_path=f"{str(video_file)[:-4].mp3", output_format=f"{output_format}"
|
38 |
)
|
39 |
return audio
|
40 |
|
|
|
51 |
asr_model = pipeline(task="automatic-speech-recognition", model="openai/whisper-large-v3")
|
52 |
return asr_model
|
53 |
|
54 |
+
def transcribe_video(processed_audio):
|
55 |
transcriber_model = load_asr_model()
|
56 |
+
text_extract = transcriber_model(processed_audio)
|
57 |
return text_extract['text']
|
58 |
|
59 |
def generate_ai_summary(transcript):
|
|
|
76 |
if url:
|
77 |
if st.button("Transcribe", key="yturl"):
|
78 |
with st.spinner("Transcribing..."):
|
79 |
+
audio = audio_extraction(yt_video, "mp3")
|
80 |
+
audio = audio_processing(audio)
|
81 |
ytvideo_transcript = transcribe_video(audio)
|
82 |
st.success(f"Transcription successful")
|
83 |
st.write(ytvideo_transcript)
|
|
|
99 |
if st.button("Transcribe", key="vidfile"):
|
100 |
with st.spinner("Transcribing..."):
|
101 |
audio = audio_extraction(os.fspath(video_file), "mp3")
|
102 |
+
audio = audio_processing(audio)
|
103 |
video_transcript = transcribe_video(audio)
|
104 |
st.success(f"Transcription successful")
|
105 |
st.write(video_transcript)
|