Update README.md
Browse files
README.md
CHANGED
@@ -71,32 +71,7 @@ Use the code below to get started with the model.
|
|
71 |
|
72 |
|
73 |
## Running the model
|
74 |
-
|
75 |
-
```python
|
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
|
95 |
-
predicted_ids = torch.argmax(logits, dim=-1)
|
96 |
-
transcription = processor.batch_decode(predicted_ids)
|
97 |
-
print(transcription[0])
|
98 |
-
</details>
|
99 |
-
```python
|
100 |
## Training Details
|
101 |
|
102 |
### Training Data
|
|
|
71 |
|
72 |
|
73 |
## Running the model
|
74 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
## Training Details
|
76 |
|
77 |
### Training Data
|