Baghdad99 commited on
Commit
47453aa
1 Parent(s): 952235c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -21,8 +21,14 @@ 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
  # Use the speech recognition pipeline to transcribe the audio
25
- output = pipe(audio_data.astype(np.float64)) # Convert to Double
26
 
27
  print(f"Output: {output}") # Print the output to see what it contains
28
 
 
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.float64)
29
+
30
  # Use the speech recognition pipeline to transcribe the audio
31
+ output = pipe(audio_data_float64)
32
 
33
  print(f"Output: {output}") # Print the output to see what it contains
34