Spaces:
Sleeping
Sleeping
Update wav2vec_aligen.py
Browse files- wav2vec_aligen.py +6 -6
wav2vec_aligen.py
CHANGED
@@ -28,13 +28,13 @@ def get_emissions(input_values, 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 -
|
38 |
elif value < 10:
|
39 |
value = 10
|
40 |
else: None
|
@@ -44,10 +44,10 @@ def speaker_pronunciation_assesment(audio_path):
|
|
44 |
input_values = load_audio(audio_path, processor)
|
45 |
result_scores = get_emissions(input_values, model)
|
46 |
|
47 |
-
pronunciation_score = vlaidate_range(round(result_scores[0].cpu().item()))
|
48 |
-
fluency_score
|
49 |
-
total_score
|
50 |
-
content_scores
|
51 |
|
52 |
|
53 |
|
|
|
28 |
results = model(input_values,).logits[0]
|
29 |
return results
|
30 |
|
31 |
+
def validate_range(value, minus):
|
32 |
value = 10 + value * 80
|
33 |
if value > 90:
|
34 |
return 90
|
35 |
|
36 |
if value < 50 and value > 10:
|
37 |
+
value = value - minus
|
38 |
elif value < 10:
|
39 |
value = 10
|
40 |
else: None
|
|
|
44 |
input_values = load_audio(audio_path, processor)
|
45 |
result_scores = get_emissions(input_values, model)
|
46 |
|
47 |
+
pronunciation_score = vlaidate_range(round(result_scores[0].cpu().item()), 5)
|
48 |
+
fluency_score = vlaidate_range(round(result_scores[1].cpu().item()), 12)
|
49 |
+
total_score = vlaidate_range(round(result_scores[2].cpu().item()), 5)
|
50 |
+
content_scores = vlaidate_range(round(result_scores[3].cpu().item()), 7)
|
51 |
|
52 |
|
53 |
|