arslanarjumand commited on
Commit
95aa3d3
1 Parent(s): 995bf88

Update wav2vec_aligen.py

Browse files
Files changed (1) hide show
  1. wav2vec_aligen.py +12 -5
wav2vec_aligen.py CHANGED
@@ -12,7 +12,7 @@ device = 'cuda' if torch.cuda.is_available() else 'cpu'
12
  torch.random.manual_seed(0);
13
  # protobuf==3.20.0
14
 
15
- model_name = "arslanarjumand/wav2vec-reptiles"
16
  processor = AutoFeatureExtractor.from_pretrained(model_name)
17
  model = Wav2Vec2BertForSequenceClassification.from_pretrained(model_name).to(device)
18
  # model = BetterTransformer.transform(model)
@@ -28,10 +28,17 @@ def get_emissions(input_values, model):
28
  results = model(input_values,).logits[0]
29
  return results
30
 
31
- def vlaidate_range(score):
32
- score = score if score <= 90 else 90
33
- score = score if score >= 10 else 10
34
- return score
 
 
 
 
 
 
 
35
 
36
  def speaker_pronunciation_assesment(audio_path):
37
  input_values = load_audio(audio_path, processor)
 
12
  torch.random.manual_seed(0);
13
  # protobuf==3.20.0
14
 
15
+ model_name = "arslanarjumand/wav2vec-read_aloud"
16
  processor = AutoFeatureExtractor.from_pretrained(model_name)
17
  model = Wav2Vec2BertForSequenceClassification.from_pretrained(model_name).to(device)
18
  # model = BetterTransformer.transform(model)
 
28
  results = model(input_values,).logits[0]
29
  return results
30
 
31
+ def validate_range(value):
32
+ value = 10 + value * 80
33
+ if value > 90:
34
+ return 90
35
+
36
+ if value < 50 and value > 10:
37
+ value = value - 5
38
+ elif value < 10:
39
+ value = 10
40
+ else: None
41
+ return int(value)
42
 
43
  def speaker_pronunciation_assesment(audio_path):
44
  input_values = load_audio(audio_path, processor)