Baghdad99 commited on
Commit
0639911
·
1 Parent(s): e0cb286

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -19,6 +19,9 @@ def translate_speech(audio_data_tuple):
19
  # Resample the audio data to 16000 Hz
20
  audio_data_resampled = librosa.resample(audio_data, sample_rate, 16000)
21
 
 
 
 
22
  # Prepare the input dictionary
23
  input_dict = asr_processor(audio_data_resampled, sampling_rate=16000, return_tensors="pt", padding=True) # Pass the resampled audio_data here
24
 
 
19
  # Resample the audio data to 16000 Hz
20
  audio_data_resampled = librosa.resample(audio_data, sample_rate, 16000)
21
 
22
+ with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp_audio_file:
23
+ sf.write(temp_audio_file.name, audio_data_resampled, 16000)
24
+
25
  # Prepare the input dictionary
26
  input_dict = asr_processor(audio_data_resampled, sampling_rate=16000, return_tensors="pt", padding=True) # Pass the resampled audio_data here
27