Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingsound import SpeechRecognitionModel
|
3 |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
4 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
def modelo1(audio):
|
|
|
|
|
|
|
7 |
model = SpeechRecognitionModel("jonatasgrosman/wav2vec2-large-xlsr-53-english")
|
8 |
transcriptions = model.transcribe(audio)
|
9 |
return transcriptions
|
|
|
1 |
import gradio as gr
|
2 |
from huggingsound import SpeechRecognitionModel
|
3 |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
4 |
+
from pydub import AudioSegment
|
5 |
+
import io
|
6 |
+
|
7 |
+
# Función para convertir la tasa de muestreo del audio de entrada
|
8 |
+
def convert_sampling_rate(audio, target_sr=48000):
|
9 |
+
audio = AudioSegment.from_wav(io.BytesIO(audio))
|
10 |
+
audio = audio.set_frame_rate(target_sr)
|
11 |
+
return audio.raw_data
|
12 |
|
13 |
def modelo1(audio):
|
14 |
+
# Convertir la tasa de muestreo del audio
|
15 |
+
audio = convert_sampling_rate(audio)
|
16 |
+
|
17 |
model = SpeechRecognitionModel("jonatasgrosman/wav2vec2-large-xlsr-53-english")
|
18 |
transcriptions = model.transcribe(audio)
|
19 |
return transcriptions
|