CineAI commited on
Commit
fd86276
1 Parent(s): 204958c

Update audio2text/a2t.py

Browse files
Files changed (1) hide show
  1. audio2text/a2t.py +3 -4
audio2text/a2t.py CHANGED
@@ -40,15 +40,14 @@ class A2T:
40
 
41
  def predict(self):
42
  if self.mic is not None:
43
- audio = self.mic.get_array_of_samples()
44
- audio = np.array(audio)
45
- frame_rate = self.mic.frame_rate
46
  else:
47
  return "please provide audio"
48
 
49
  try:
50
  forced_decoder_ids = processor.get_decoder_prompt_ids(language="english", task="transcribe")
51
- audio = self.__preprocces(audio=audio, frame_rate=frame_rate)
52
  inputs = processor(audio=audio, sampling_rate=16000, return_tensors="pt")
53
  predicted_ids = model.generate(**inputs, max_length=400, forced_decoder_ids=forced_decoder_ids)
54
  transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
 
40
 
41
  def predict(self):
42
  if self.mic is not None:
43
+ audio = self.mic
44
+ # frame_rate = self.mic.frame_rate
 
45
  else:
46
  return "please provide audio"
47
 
48
  try:
49
  forced_decoder_ids = processor.get_decoder_prompt_ids(language="english", task="transcribe")
50
+ # audio = self.__preprocces(audio=audio, frame_rate=frame_rate)
51
  inputs = processor(audio=audio, sampling_rate=16000, return_tensors="pt")
52
  predicted_ids = model.generate(**inputs, max_length=400, forced_decoder_ids=forced_decoder_ids)
53
  transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)