juliuserictuliao commited on
Commit
ce76330
·
verified ·
1 Parent(s): b2ca7f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -22,7 +22,11 @@ def asr_transcript(audio):
22
  return ""
23
 
24
  # Ensure audio is a 1D numpy array
25
- audio = np.concatenate(audio).ravel()
 
 
 
 
26
 
27
  # Process the audio
28
  input_values = processor(audio, sampling_rate=16000, return_tensors="pt").input_values
 
22
  return ""
23
 
24
  # Ensure audio is a 1D numpy array
25
+ if isinstance(audio, list):
26
+ audio = np.array(audio)
27
+
28
+ if audio.ndim > 1:
29
+ audio = audio.flatten()
30
 
31
  # Process the audio
32
  input_values = processor(audio, sampling_rate=16000, return_tensors="pt").input_values