Update README.md
Browse files
README.md
CHANGED
@@ -76,19 +76,19 @@ Use the code below to get started with the model.
|
|
76 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
77 |
import torch
|
78 |
import torchaudio
|
79 |
-
|
80 |
model_id = "fastinom/ASR_fassy"
|
81 |
model = Wav2Vec2ForCTC.from_pretrained(model_id)
|
82 |
processor = Wav2Vec2Processor.from_pretrained(model_id)
|
83 |
-
|
84 |
def load_audio(file_path):
|
85 |
speech_array, sampling_rate = torchaudio.load(file_path)
|
86 |
resampler = torchaudio.transforms.Resample(sampling_rate, 16000)
|
87 |
speech = resampler(speech_array).squeeze().numpy()
|
88 |
return speech
|
89 |
-
audio_file = "/content/drive/MyDrive/recordings/wavefiles/1.
|
90 |
speech = load_audio(audio_file)
|
91 |
-
|
92 |
inputs = processor(speech, sampling_rate=16000, return_tensors="pt", padding=True)
|
93 |
with torch.no_grad():
|
94 |
logits = model(inputs.input_values).logits
|
|
|
76 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
77 |
import torch
|
78 |
import torchaudio
|
79 |
+
|
80 |
model_id = "fastinom/ASR_fassy"
|
81 |
model = Wav2Vec2ForCTC.from_pretrained(model_id)
|
82 |
processor = Wav2Vec2Processor.from_pretrained(model_id)
|
83 |
+
|
84 |
def load_audio(file_path):
|
85 |
speech_array, sampling_rate = torchaudio.load(file_path)
|
86 |
resampler = torchaudio.transforms.Resample(sampling_rate, 16000)
|
87 |
speech = resampler(speech_array).squeeze().numpy()
|
88 |
return speech
|
89 |
+
audio_file = "/content/drive/MyDrive/recordings/wavefiles/1.wav"
|
90 |
speech = load_audio(audio_file)
|
91 |
+
|
92 |
inputs = processor(speech, sampling_rate=16000, return_tensors="pt", padding=True)
|
93 |
with torch.no_grad():
|
94 |
logits = model(inputs.input_values).logits
|