Spaces:
Runtime error
Runtime error
initial commit
Browse files
app.py
CHANGED
@@ -7,19 +7,21 @@ import pickle
|
|
7 |
import soundfile
|
8 |
import librosa
|
9 |
|
10 |
-
classifier = pickle.load(open('
|
11 |
|
12 |
def emotion_predict(input):
|
13 |
input_features = extract_feature(input, mfcc=True, chroma=True, mel=True, contrast=True, tonnetz=True)
|
14 |
rf_prediction = classifier.predict(input_features.reshape(1,-1))
|
15 |
-
if rf_prediction == '
|
16 |
-
return '
|
17 |
-
elif rf_prediction == '
|
18 |
-
return '
|
19 |
-
elif rf_prediction == '
|
20 |
-
return '
|
|
|
|
|
21 |
else:
|
22 |
-
return '
|
23 |
|
24 |
|
25 |
def plot_fig(input):
|
@@ -52,11 +54,11 @@ with gr.Blocks() as app:
|
|
52 |
gr.Markdown(
|
53 |
"""
|
54 |
# PROLOVE π΅
|
55 |
-
This application classifies inputted audio π according to
|
56 |
-
1.
|
57 |
-
2.
|
58 |
-
3.
|
59 |
-
4.
|
60 |
"""
|
61 |
)
|
62 |
with gr.Tab("Record Audio"):
|
|
|
7 |
import soundfile
|
8 |
import librosa
|
9 |
|
10 |
+
classifier = pickle.load(open('prolove.pkl', 'rb'))
|
11 |
|
12 |
def emotion_predict(input):
|
13 |
input_features = extract_feature(input, mfcc=True, chroma=True, mel=True, contrast=True, tonnetz=True)
|
14 |
rf_prediction = classifier.predict(input_features.reshape(1,-1))
|
15 |
+
if rf_prediction == 'kata_benda':
|
16 |
+
return 'kata_benda'
|
17 |
+
elif rf_prediction == 'kata_kerja':
|
18 |
+
return 'kata_kerja'
|
19 |
+
elif rf_prediction == 'kata_keterangan':
|
20 |
+
return 'kata_keterangan'
|
21 |
+
elif rf_prediction == 'kata_sifat':
|
22 |
+
return 'kata_sifat'
|
23 |
else:
|
24 |
+
return 'LOLπ€'
|
25 |
|
26 |
|
27 |
def plot_fig(input):
|
|
|
54 |
gr.Markdown(
|
55 |
"""
|
56 |
# PROLOVE π΅
|
57 |
+
This application classifies inputted audio π according to pronunciation into four categories:
|
58 |
+
1. kata_benda π
|
59 |
+
2. kata_kerja π
|
60 |
+
3. kata_keterangan π’
|
61 |
+
4. kata_sifat π€
|
62 |
"""
|
63 |
)
|
64 |
with gr.Tab("Record Audio"):
|