humeur commited on
Commit
87ecdde
1 Parent(s): f7afbb9
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,9 +18,9 @@ class GradioInference():
18
  self.yt = YouTube(link)
19
  path = self.yt.streams.filter(only_audio=True)[0].download(filename="tmp.mp4")
20
  subprocess.run([
21
- 'ffmpeg', '-i', 'tmp.mp4', 'tmp.mp3'
22
  ])
23
- sound_data = soundfile.read('tmp.mp3')
24
  input_features = self.processor(sound_data, return_tensors="pt").input_features
25
  forced_decoder_ids = self.processor.get_decoder_prompt_ids(language = "sv", task = "translate")
26
  predicted_ids = self.model.generate(input_features, forced_decoder_ids = forced_decoder_ids)
 
18
  self.yt = YouTube(link)
19
  path = self.yt.streams.filter(only_audio=True)[0].download(filename="tmp.mp4")
20
  subprocess.run([
21
+ 'ffmpeg', '-i', 'tmp.mp4','-vn', '-acodec', 'pcm_s16le', '-ac', '1', '-ar', '44100', '-f' 'wav','tmp.wav'
22
  ])
23
+ sound_data = soundfile.read('tmp.wav')
24
  input_features = self.processor(sound_data, return_tensors="pt").input_features
25
  forced_decoder_ids = self.processor.get_decoder_prompt_ids(language = "sv", task = "translate")
26
  predicted_ids = self.model.generate(input_features, forced_decoder_ids = forced_decoder_ids)