Spaces:
Build error
Build error
Update utils_hf.py
Browse files- utils_hf.py +2 -2
utils_hf.py
CHANGED
|
@@ -133,14 +133,14 @@ def transcribe_audio(audio_path):
|
|
| 133 |
"""
|
| 134 |
try:
|
| 135 |
# Leer el archivo de audio y convertirlo en un numpy ndarray
|
| 136 |
-
audio_data,
|
| 137 |
|
| 138 |
# Convertir a un solo canal si es necesario
|
| 139 |
if len(audio_data.shape) > 1:
|
| 140 |
audio_data = np.mean(audio_data, axis=1)
|
| 141 |
|
| 142 |
# Transcribir el audio usando el modelo Whisper
|
| 143 |
-
transcript = whisper_pipeline(audio_data
|
| 144 |
return transcript['text']
|
| 145 |
except Exception as e:
|
| 146 |
st.error(f"Error al transcribir el audio: {e}")
|
|
|
|
| 133 |
"""
|
| 134 |
try:
|
| 135 |
# Leer el archivo de audio y convertirlo en un numpy ndarray
|
| 136 |
+
audio_data, _ = sf.read(audio_path)
|
| 137 |
|
| 138 |
# Convertir a un solo canal si es necesario
|
| 139 |
if len(audio_data.shape) > 1:
|
| 140 |
audio_data = np.mean(audio_data, axis=1)
|
| 141 |
|
| 142 |
# Transcribir el audio usando el modelo Whisper
|
| 143 |
+
transcript = whisper_pipeline(audio_data)
|
| 144 |
return transcript['text']
|
| 145 |
except Exception as e:
|
| 146 |
st.error(f"Error al transcribir el audio: {e}")
|