tiantiaf commited on
Commit
ccc402e
·
verified ·
1 Parent(s): 702ebe7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -5
README.md CHANGED
@@ -45,7 +45,7 @@ pip install -e .
45
  ```
46
 
47
  ## Load the model
48
- ```
49
  # Load libraries
50
  import torch
51
  import torch.nn.functional as F
@@ -60,7 +60,7 @@ model.eval()
60
  ```
61
 
62
  ## Prediction
63
- ```
64
  audio_data = torch.zeros([1, 16000*10]).float().to(device)
65
  audio_segment = (audio_data.shape[1] - 3*16000) // 16000 + 1
66
  if audio_segment < 1: audio_segment = 1
@@ -73,7 +73,7 @@ input_audio = torch.stack(input_audio, dim=0)
73
  input_audio_length = torch.stack(input_audio_length, dim=0)
74
  ```
75
  ## Prediction
76
- ```
77
  fluency_outputs, disfluency_type_outputs = model(input_audio, length=input_audio_length)
78
  fluency_prob = F.softmax(fluency_outputs, dim=1).detach().cpu().numpy().astype(float).tolist()
79
 
@@ -83,8 +83,8 @@ disfluency_type_predictions = (disfluency_type_prob > 0.7).int().detach().cpu().
83
  disfluency_type_prob = disfluency_type_prob.cpu().numpy().astype(float).tolist()
84
  ```
85
 
86
- ## Now lets gather the predictions for the utterance
87
- ```
88
  utterance_fluency_list = list()
89
  utterance_disfluency_list = list()
90
  for audio_idx in range(audio_segment):
 
45
  ```
46
 
47
  ## Load the model
48
+ ```python
49
  # Load libraries
50
  import torch
51
  import torch.nn.functional as F
 
60
  ```
61
 
62
  ## Prediction
63
+ ```python
64
  audio_data = torch.zeros([1, 16000*10]).float().to(device)
65
  audio_segment = (audio_data.shape[1] - 3*16000) // 16000 + 1
66
  if audio_segment < 1: audio_segment = 1
 
73
  input_audio_length = torch.stack(input_audio_length, dim=0)
74
  ```
75
  ## Prediction
76
+ ```python
77
  fluency_outputs, disfluency_type_outputs = model(input_audio, length=input_audio_length)
78
  fluency_prob = F.softmax(fluency_outputs, dim=1).detach().cpu().numpy().astype(float).tolist()
79
 
 
83
  disfluency_type_prob = disfluency_type_prob.cpu().numpy().astype(float).tolist()
84
  ```
85
 
86
+ ## Now let's gather the predictions for the utterance
87
+ ```python
88
  utterance_fluency_list = list()
89
  utterance_disfluency_list = list()
90
  for audio_idx in range(audio_segment):