Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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'
|