Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,10 @@ import torch
|
|
8 |
import torchaudio
|
9 |
|
10 |
pipe = pipeline(model="thak123/gom-stt-v3", #"thak123/whisper-small-LDC-V1", #"thak123/whisper-small-gom",
|
11 |
-
task="automatic-speech-recognition",
|
|
|
|
|
|
|
12 |
|
13 |
# pipe.model.config.forced_decoder_ids = (
|
14 |
# pipe.tokenizer.get_decoder_prompt_ids(
|
@@ -17,14 +20,14 @@ pipe = pipeline(model="thak123/gom-stt-v3", #"thak123/whisper-small-LDC-V1", #"t
|
|
17 |
# )
|
18 |
|
19 |
def transcribe_speech(filepath):
|
20 |
-
waveform, sample_rate = torchaudio.load(filepath)
|
21 |
|
22 |
# Resample the audio signal to 16k sampling rate
|
23 |
-
resampler = torchaudio.transforms.Resample(sample_rate, 16000)
|
24 |
-
waveform_16k = resampler(waveform)
|
25 |
|
26 |
# Save the resampled audio signal to a new file
|
27 |
-
torchaudio.save(filepath, waveform_16k, 16000)
|
28 |
output = pipe(
|
29 |
filepath,
|
30 |
max_new_tokens=256,
|
|
|
8 |
import torchaudio
|
9 |
|
10 |
pipe = pipeline(model="thak123/gom-stt-v3", #"thak123/whisper-small-LDC-V1", #"thak123/whisper-small-gom",
|
11 |
+
task="automatic-speech-recognition",
|
12 |
+
tokenizer= tokenizer,
|
13 |
+
sampling_rate=16000,
|
14 |
+
) # change to "your-username/the-name-you-picked"
|
15 |
|
16 |
# pipe.model.config.forced_decoder_ids = (
|
17 |
# pipe.tokenizer.get_decoder_prompt_ids(
|
|
|
20 |
# )
|
21 |
|
22 |
def transcribe_speech(filepath):
|
23 |
+
# waveform, sample_rate = torchaudio.load(filepath)
|
24 |
|
25 |
# Resample the audio signal to 16k sampling rate
|
26 |
+
# resampler = torchaudio.transforms.Resample(sample_rate, 16000)
|
27 |
+
# waveform_16k = resampler(waveform)
|
28 |
|
29 |
# Save the resampled audio signal to a new file
|
30 |
+
# torchaudio.save(filepath, waveform_16k, 16000)
|
31 |
output = pipe(
|
32 |
filepath,
|
33 |
max_new_tokens=256,
|