Spaces:
Runtime error
Runtime error
initial commit
Browse files
app.py
CHANGED
@@ -12,14 +12,14 @@ classifier = pickle.load(open('finalized_rf.sav', 'rb'))
|
|
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):
|
@@ -51,12 +51,13 @@ def plot_fig(input):
|
|
51 |
with gr.Blocks() as app:
|
52 |
gr.Markdown(
|
53 |
"""
|
54 |
-
#
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
"""
|
61 |
)
|
62 |
with gr.Tab("Record Audio"):
|
@@ -71,8 +72,8 @@ with gr.Blocks() as app:
|
|
71 |
plot_record = gr.Button("Display Audio Signal")
|
72 |
plot_record_c = gr.Plot(label='Waveform Of the Audio')
|
73 |
|
74 |
-
record_button = gr.Button("Detect
|
75 |
-
record_output = gr.Text(label = '
|
76 |
|
77 |
with gr.Tab("Upload Audio File"):
|
78 |
gr.Markdown(
|
@@ -92,8 +93,8 @@ with gr.Blocks() as app:
|
|
92 |
plot_upload = gr.Button("Display Audio Signal")
|
93 |
plot_upload_c = gr.Plot(label='Waveform Of the Audio')
|
94 |
|
95 |
-
upload_button = gr.Button("Detect
|
96 |
-
upload_output = gr.Text(label = '
|
97 |
|
98 |
record_button.click(emotion_predict, inputs=record_input, outputs=record_output)
|
99 |
upload_button.click(emotion_predict, inputs=upload_input, outputs=upload_output)
|
|
|
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 |
else:
|
22 |
+
return 'kata-sifat'
|
23 |
|
24 |
|
25 |
def plot_fig(input):
|
|
|
51 |
with gr.Blocks() as app:
|
52 |
gr.Markdown(
|
53 |
"""
|
54 |
+
# πPROLOVE π΅πΈπΌ
|
55 |
+
|
56 |
+
This application classifies inputted audio according to pronunciation into four categories:
|
57 |
+
1. kata benda
|
58 |
+
2. kata kerja
|
59 |
+
3. kata keterangan
|
60 |
+
4. kata sifat
|
61 |
"""
|
62 |
)
|
63 |
with gr.Tab("Record Audio"):
|
|
|
72 |
plot_record = gr.Button("Display Audio Signal")
|
73 |
plot_record_c = gr.Plot(label='Waveform Of the Audio')
|
74 |
|
75 |
+
record_button = gr.Button("Detect vocabulary")
|
76 |
+
record_output = gr.Text(label = 'result')
|
77 |
|
78 |
with gr.Tab("Upload Audio File"):
|
79 |
gr.Markdown(
|
|
|
93 |
plot_upload = gr.Button("Display Audio Signal")
|
94 |
plot_upload_c = gr.Plot(label='Waveform Of the Audio')
|
95 |
|
96 |
+
upload_button = gr.Button("Detect vocabulary")
|
97 |
+
upload_output = gr.Text(label = 'result')
|
98 |
|
99 |
record_button.click(emotion_predict, inputs=record_input, outputs=record_output)
|
100 |
upload_button.click(emotion_predict, inputs=upload_input, outputs=upload_output)
|