alvi123 commited on
Commit
6d58e97
·
1 Parent(s): 6381c3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -10,7 +10,7 @@ import numpy as np
10
 
11
 
12
 
13
- model = load_model(os.path.join("model", "Emotion_Voice_Detection_Model_tuned_2.h5"))
14
 
15
 
16
  def convert_class_to_emotion(pred):
@@ -27,14 +27,10 @@ def convert_class_to_emotion(pred):
27
  # 6: 'disgust',
28
  # 7: 'surprised'}
29
 
30
- label_conversion = {0: 'very happy',
31
- 1: 'happy',
32
- 2: 'very happy',
33
- 3: 'very unhappy',
34
- 4: 'very unhappy',
35
- 5: 'unhappy',
36
- 6: 'unhappy',
37
- 7: 'happy'}
38
 
39
  return label_conversion[int(pred)]
40
 
@@ -61,14 +57,10 @@ def make_predictions(file, micro=None):
61
 
62
  N = 8
63
  theta = radar_factory(N, frame='polygon')
64
- spoke_labels = np.array(['neutral',
65
- 'calm',
66
- 'happy',
67
- 'sad',
68
- 'angry',
69
- 'fearful',
70
- 'disgust',
71
- 'surprised'])
72
  fig_radar, axs = plt.subplots(figsize=(8, 8), nrows=1, ncols=1,
73
  subplot_kw=dict(projection='radar'))
74
  vec = model.predict(x)[0]
@@ -99,4 +91,4 @@ iface = gr.Interface(
99
  examples=[[os.path.join("examples", filename)] for filename in os.listdir("examples")],
100
  outputs=[gr.Textbox(label="Text output"), gr.Plot(), gr.Plot()]
101
  )
102
- iface.launch(share=True)
 
10
 
11
 
12
 
13
+ model = load_model(os.path.join("model", "Speech_Recognition_Model.h5"))
14
 
15
 
16
  def convert_class_to_emotion(pred):
 
27
  # 6: 'disgust',
28
  # 7: 'surprised'}
29
 
30
+ label_conversion = {0: 'kata_sifat',
31
+ 1: 'kata_benda',
32
+ 2: 'kata_kerja',
33
+ 3: 'kata_keterangan}
 
 
 
 
34
 
35
  return label_conversion[int(pred)]
36
 
 
57
 
58
  N = 8
59
  theta = radar_factory(N, frame='polygon')
60
+ spoke_labels = np.array(['kata_sifat',
61
+ 'kata_benda',
62
+ 'kata_kerja',
63
+ 'kata_keterangan'])
 
 
 
 
64
  fig_radar, axs = plt.subplots(figsize=(8, 8), nrows=1, ncols=1,
65
  subplot_kw=dict(projection='radar'))
66
  vec = model.predict(x)[0]
 
91
  examples=[[os.path.join("examples", filename)] for filename in os.listdir("examples")],
92
  outputs=[gr.Textbox(label="Text output"), gr.Plot(), gr.Plot()]
93
  )
94
+ iface.launch(debug=True)