Update app.py
Browse files
app.py
CHANGED
|
@@ -46,8 +46,8 @@ def transcribe(audio):
|
|
| 46 |
y = y.mean(axis=1)
|
| 47 |
|
| 48 |
# resample to 16kHz if needed
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
y = y.astype(np.float32)
|
| 53 |
y /= np.max(np.abs(y))
|
|
|
|
| 46 |
y = y.mean(axis=1)
|
| 47 |
|
| 48 |
# resample to 16kHz if needed
|
| 49 |
+
if sr != 16000:
|
| 50 |
+
y = librosa.resample(y, orig_sr=sr, target_sr=16000)
|
| 51 |
|
| 52 |
y = y.astype(np.float32)
|
| 53 |
y /= np.max(np.abs(y))
|