sanchit-gandhi HF staff commited on
Commit
2a98152
1 Parent(s): 86aed81

error out for empty audio

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -28,6 +28,8 @@ def format_as_transcription(raw_segments, with_timestamps=False):
28
 
29
 
30
  def transcribe(file_upload, with_timestamps):
 
 
31
  raw_segments = pipe(file_upload)
32
  transcription = format_as_transcription(raw_segments, with_timestamps=with_timestamps)
33
  return transcription
 
28
 
29
 
30
  def transcribe(file_upload, with_timestamps):
31
+ if file_upload is None:
32
+ raise gr.Error("No audio file submitted! Please upload an audio file before submitting your request.")
33
  raw_segments = pipe(file_upload)
34
  transcription = format_as_transcription(raw_segments, with_timestamps=with_timestamps)
35
  return transcription