Spaces:
Running
Running
Update audio_to_text.py
Browse files- audio_to_text.py +1 -1
audio_to_text.py
CHANGED
@@ -9,7 +9,7 @@ model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny")
|
|
9 |
model.config.forced_decoder_ids = None
|
10 |
|
11 |
|
12 |
-
def audio_to_text(audio_data):
|
13 |
# Convert raw audio frame (numpy array) to tensor and resample it to 16 kHz
|
14 |
waveform = torch.tensor(audio_data, dtype=torch.float32).unsqueeze(0)
|
15 |
# Check if the sample rate is 16 kHz; if not, resample it
|
|
|
9 |
model.config.forced_decoder_ids = None
|
10 |
|
11 |
|
12 |
+
def audio_to_text(audio_data,sample_rate):
|
13 |
# Convert raw audio frame (numpy array) to tensor and resample it to 16 kHz
|
14 |
waveform = torch.tensor(audio_data, dtype=torch.float32).unsqueeze(0)
|
15 |
# Check if the sample rate is 16 kHz; if not, resample it
|