Baghdad99 commited on
Commit
7c94b0d
1 Parent(s): a63c502

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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