Update app.py
Browse files
app.py
CHANGED
@@ -23,11 +23,11 @@ def translate_speech(audio):
|
|
23 |
output = pipe(audio_data)
|
24 |
print(f"Output: {output}") # Print the output to see what it contains
|
25 |
|
26 |
-
# Check if the output contains 'text'
|
27 |
-
if 'text' in output[0]:
|
28 |
transcription = output[0]["text"]
|
29 |
else:
|
30 |
-
print("The output does not contain 'text'")
|
31 |
return
|
32 |
|
33 |
# Use the translation pipeline to translate the transcription
|
|
|
23 |
output = pipe(audio_data)
|
24 |
print(f"Output: {output}") # Print the output to see what it contains
|
25 |
|
26 |
+
# Check if the output is not empty and contains 'text'
|
27 |
+
if output and 'text' in output[0]:
|
28 |
transcription = output[0]["text"]
|
29 |
else:
|
30 |
+
print("The output is empty or does not contain 'text'")
|
31 |
return
|
32 |
|
33 |
# Use the translation pipeline to translate the transcription
|