Baghdad99 commited on
Commit
aef1f22
1 Parent(s): b175466

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -21,11 +21,11 @@ def translate_speech(audio_data_tuple):
21
  # Print the shape and type of the audio data
22
  print(f"Audio data type: {type(audio_data)}, Audio data shape: {audio_data.shape}")
23
 
24
- # Normalize the audio data to the range [0, 1]
25
- audio_data_normalized = (audio_data - np.iinfo(audio_data.dtype).min) / (np.iinfo(audio_data.dtype).max - np.iinfo(audio_data.dtype).min)
26
-
27
  # Convert the normalized audio data to float64
28
- audio_data_float64 = audio_data_normalized.astype(np.float64)
29
 
30
  # Use the speech recognition pipeline to transcribe the audio
31
  output = pipe(audio_data_float64)
 
21
  # Print the shape and type of the audio data
22
  print(f"Audio data type: {type(audio_data)}, Audio data shape: {audio_data.shape}")
23
 
24
+ # Normalize the audio data to the range [-1, 1]
25
+ audio_data_normalized = audio_data / np.iinfo(audio_data.dtype).max
26
+
27
  # Convert the normalized audio data to float64
28
+ audio_data_float64 = audio_data_normalized.astype(np.float32)
29
 
30
  # Use the speech recognition pipeline to transcribe the audio
31
  output = pipe(audio_data_float64)