Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
accuracy_classifier = pipeline(task="audio-classification", model="JohnJumon/pronunciation_accuracy")
|
5 |
fluency_classifier = pipeline(task="audio-classification", model="JohnJumon/fluency_accuracy")
|
6 |
prosodic_classifier = pipeline(task="audio-classification", model="JohnJumon/prosodic_accuracy")
|
7 |
|
8 |
def pronunciation_scoring(audio):
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
12 |
result = {
|
13 |
'accuracy': accuracy,
|
14 |
'fluency': fluency,
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
import numpy as np
|
4 |
|
5 |
accuracy_classifier = pipeline(task="audio-classification", model="JohnJumon/pronunciation_accuracy")
|
6 |
fluency_classifier = pipeline(task="audio-classification", model="JohnJumon/fluency_accuracy")
|
7 |
prosodic_classifier = pipeline(task="audio-classification", model="JohnJumon/prosodic_accuracy")
|
8 |
|
9 |
def pronunciation_scoring(audio):
|
10 |
+
y = audio
|
11 |
+
y = y.astype(np.float32)
|
12 |
+
y /= np.max(np.abs(y))
|
13 |
+
accuracy = accuracy_classifier(y)
|
14 |
+
fluency = fluency_classifier(y)
|
15 |
+
prosodic = prosodic_classifier(y)
|
16 |
result = {
|
17 |
'accuracy': accuracy,
|
18 |
'fluency': fluency,
|