JohnJumon commited on
Commit
c4c15bc
1 Parent(s): 2e9243a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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
- accuracy = accuracy_classifier(audio)
10
- fluency = fluency_classifier(audio)
11
- prosodic = prosodic_classifier(audio)
 
 
 
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,