Baghdad99 commited on
Commit
c088ffc
1 Parent(s): 1826b6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -22,9 +22,16 @@ def translate_speech(audio_file):
22
  # Convert the audio to mono and get the raw data
23
  audio = audio.set_channels(1)
24
  audio_data = np.array(audio.get_array_of_samples())
25
-
 
 
 
 
 
 
26
  # Use the speech recognition pipeline to transcribe the audio
27
  output = pipe(audio_data)
 
28
  print(f"Output: {output}") # Print the output to see what it contains
29
 
30
  # Check if the output contains 'text'
 
22
  # Convert the audio to mono and get the raw data
23
  audio = audio.set_channels(1)
24
  audio_data = np.array(audio.get_array_of_samples())
25
+
26
+ # Convert the numpy array to a PyTorch tensor
27
+ audio_data = torch.from_numpy(audio_data)
28
+
29
+ # Convert the tensor to double
30
+ audio_data = audio_data.double()
31
+
32
  # Use the speech recognition pipeline to transcribe the audio
33
  output = pipe(audio_data)
34
+
35
  print(f"Output: {output}") # Print the output to see what it contains
36
 
37
  # Check if the output contains 'text'