vineelpratap commited on
Commit
b226b85
1 Parent(s): cd75560

Update asr.py

Browse files
Files changed (1) hide show
  1. asr.py +3 -13
asr.py CHANGED
@@ -67,19 +67,9 @@ model = Wav2Vec2ForCTC.from_pretrained(MODEL_ID)
67
 
68
 
69
  def transcribe(
70
- audio_source=None, microphone=None, file_upload=None, lang="eng (English)"
71
- ):
72
- if type(microphone) is dict:
73
- # HACK: microphone variable is a dict when running on examples
74
- microphone = microphone["name"]
75
- audio_fp = (
76
- file_upload if "upload" in str(audio_source or "").lower() else microphone
77
- )
78
-
79
- if audio_fp is None:
80
- return "ERROR: You have to either use the microphone or upload an audio file"
81
-
82
- audio_samples = librosa.load(audio_fp, sr=ASR_SAMPLING_RATE, mono=True)[0]
83
 
84
  lang_code = lang.split()[0]
85
  processor.tokenizer.set_target_lang(lang_code)
 
67
 
68
 
69
  def transcribe(
70
+ audio_data, lang="eng (English)"
71
+ ):
72
+ sr, audio_samples = audio_data
 
 
 
 
 
 
 
 
 
 
73
 
74
  lang_code = lang.split()[0]
75
  processor.tokenizer.set_target_lang(lang_code)