Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
615813d
1
Parent(s):
b6fdfee
fix: handle tuple audio input in transcribe function and skip empty tuples
Browse files
app.py
CHANGED
@@ -29,6 +29,14 @@ 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, np.ndarray):
|
33 |
audio_buffer.append(audio)
|
34 |
# Process if buffer has enough data (e.g., 5 seconds at 16kHz)
|
|
|
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[0] if len(audio) > 0 else None
|
36 |
+
if not audio:
|
37 |
+
print("Empty tuple, skipping")
|
38 |
+
return state, state
|
39 |
+
|
40 |
if isinstance(audio, np.ndarray):
|
41 |
audio_buffer.append(audio)
|
42 |
# Process if buffer has enough data (e.g., 5 seconds at 16kHz)
|