Athspi commited on
Commit
489a7ef
·
verified ·
1 Parent(s): 9bdcb0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,8 +1,11 @@
 
 
 
1
  import gradio as gr
2
  import torch
3
  import os
4
  from faster_whisper import WhisperModel
5
- from moviepy.editor import VideoFileClip
6
 
7
  # Define the model and device
8
  MODEL_NAME = "Systran/faster-whisper-large-v3"
@@ -34,7 +37,7 @@ SUPPORTED_LANGUAGES = [
34
 
35
  def extract_audio_from_video(video_file):
36
  """Extract audio from a video file and save it as a WAV file."""
37
- video = VideoFileClip(video_file)
38
  audio_file = "extracted_audio.wav"
39
  video.audio.write_audiofile(audio_file, fps=16000)
40
  return audio_file
 
1
+ # Dependencies:
2
+ # pip install gradio faster-whisper moviepy torch
3
+
4
  import gradio as gr
5
  import torch
6
  import os
7
  from faster_whisper import WhisperModel
8
+ from moviepy import editor # Updated import
9
 
10
  # Define the model and device
11
  MODEL_NAME = "Systran/faster-whisper-large-v3"
 
37
 
38
  def extract_audio_from_video(video_file):
39
  """Extract audio from a video file and save it as a WAV file."""
40
+ video = editor.VideoFileClip(video_file)
41
  audio_file = "extracted_audio.wav"
42
  video.audio.write_audiofile(audio_file, fps=16000)
43
  return audio_file