Spaces:
Edmond98
/
Running on A100

vineelpratap commited on
Commit
408e3fc
1 Parent(s): bec2b9c

Update asr.py

Browse files
Files changed (1) hide show
  1. asr.py +4 -0
asr.py CHANGED
@@ -43,6 +43,10 @@ def transcribe(
43
  audio_fp = (
44
  file_upload if "upload" in str(audio_source or "").lower() else microphone
45
  )
 
 
 
 
46
  audio_samples = librosa.load(audio_fp, sr=ASR_SAMPLING_RATE, mono=True)[0]
47
 
48
  lang_code = lang.split()[0]
 
43
  audio_fp = (
44
  file_upload if "upload" in str(audio_source or "").lower() else microphone
45
  )
46
+
47
+ if audio_fp is None:
48
+ return "ERROR: You have to either use the microphone or upload an audio file"
49
+
50
  audio_samples = librosa.load(audio_fp, sr=ASR_SAMPLING_RATE, mono=True)[0]
51
 
52
  lang_code = lang.split()[0]