younes21000 commited on
Commit
58f4eed
·
verified ·
1 Parent(s): 73c9093

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import moviepy.editor as mp
3
  import librosa
4
- import numpy as np
5
  from transformers import pipeline
6
  from concurrent.futures import ThreadPoolExecutor
7
  import tempfile
@@ -46,8 +45,8 @@ def generate_subtitles(video_file, language_name):
46
  audio = video.audio
47
 
48
  # Use a temporary file to hold the audio data
49
- with tempfile.NamedTemporaryFile(delete=True) as tmp_audio_file:
50
- audio.write_audiofile(tmp_audio_file.name, codec='pcm_s16le')
51
 
52
  print("Starting speech-to-text transcription")
53
 
 
1
  import gradio as gr
2
  import moviepy.editor as mp
3
  import librosa
 
4
  from transformers import pipeline
5
  from concurrent.futures import ThreadPoolExecutor
6
  import tempfile
 
45
  audio = video.audio
46
 
47
  # Use a temporary file to hold the audio data
48
+ with tempfile.NamedTemporaryFile(delete=True, suffix='.wav') as tmp_audio_file:
49
+ audio.write_audiofile(tmp_audio_file.name, codec='pcm_s16le') # Specify codec as pcm_s16le
50
 
51
  print("Starting speech-to-text transcription")
52