GavinHuang commited on
Commit
4d5cbf1
·
1 Parent(s): c699992

fix: clean up commented code in transcribe function for clarity

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -29,17 +29,16 @@ def transcribe(audio, state=""):
29
  print(f"Received audio input of type: {type(audio)}")
30
  print(f"Audio shape: {audio.shape if isinstance(audio, np.ndarray) else 'N/A'}")
31
  # Append NumPy array to buffer
32
- if isinstance(audio, tuple):
33
- print(f"Tuple contents: {audio}")
34
- # Try extracting the first element
35
- audio = audio[1] if len(audio) > 1 else None
36
 
37
  if isinstance(audio, tuple) and len(audio) == 2 and isinstance(audio[1], np.ndarray):
38
  # Handle tuple of (sample_rate, audio_array)
39
  print(f"Tuple contents: {audio}")
40
  sample_rate, audio_data = audio
41
  try:
42
-
43
  # Resample to 16kHz for NeMo
44
  if sample_rate != 16000:
45
  print(f"Resampling from {sample_rate}Hz to 16000Hz")
 
29
  print(f"Received audio input of type: {type(audio)}")
30
  print(f"Audio shape: {audio.shape if isinstance(audio, np.ndarray) else 'N/A'}")
31
  # Append NumPy array to buffer
32
+ # if isinstance(audio, tuple):
33
+ # print(f"Tuple contents: {audio}")
34
+ # # Try extracting the first element
35
+ # audio = audio[1] if len(audio) > 1 else None
36
 
37
  if isinstance(audio, tuple) and len(audio) == 2 and isinstance(audio[1], np.ndarray):
38
  # Handle tuple of (sample_rate, audio_array)
39
  print(f"Tuple contents: {audio}")
40
  sample_rate, audio_data = audio
41
  try:
 
42
  # Resample to 16kHz for NeMo
43
  if sample_rate != 16000:
44
  print(f"Resampling from {sample_rate}Hz to 16000Hz")