THP2903 commited on
Commit
46da3ad
·
verified ·
1 Parent(s): 3fdae12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -7,7 +7,7 @@ import os
7
  import numpy as np
8
  import tensorflow as tf
9
  from tensorflow.keras.models import load_model
10
- model = load_model("./model_vui_ve.h5")
11
 
12
  # emotion_labels = {0: 'neutral', 1: 'calm', 2: 'happy', 3: 'sad', 4: 'angry', 5: 'fearful'}
13
 
@@ -143,7 +143,7 @@ def process_video_audio(video_path, audio_path):
143
  def predict_emotion(video_path, audio_path):
144
  train_visual, train_audio_wave, train_audio_cnn = process_video_audio(video_path, audio_path)
145
 
146
-
147
  predictions = model.predict({
148
  "input_visual": train_visual,
149
  "input_audio_cnn": train_audio_cnn,
@@ -157,8 +157,7 @@ def predict_emotion(video_path, audio_path):
157
 
158
  predicted_label = predict_emotion(video_path, audio_path)
159
  emotion_dict = {0: 'neutral', 1: 'calm', 2: 'happy', 3: 'sad', 4: 'angry', 5: 'fearful'}
160
- predicted_emotion = emotion_dict[predicted_label]
161
- print("Predicted Emotion: ", predicted_emotion)
162
  # Định nghĩa giao diện Gradio
163
 
164
  def predict_emotion_gradio(video, audio):
 
7
  import numpy as np
8
  import tensorflow as tf
9
  from tensorflow.keras.models import load_model
10
+
11
 
12
  # emotion_labels = {0: 'neutral', 1: 'calm', 2: 'happy', 3: 'sad', 4: 'angry', 5: 'fearful'}
13
 
 
143
  def predict_emotion(video_path, audio_path):
144
  train_visual, train_audio_wave, train_audio_cnn = process_video_audio(video_path, audio_path)
145
 
146
+ model = load_model("./model_vui_ve.h5")
147
  predictions = model.predict({
148
  "input_visual": train_visual,
149
  "input_audio_cnn": train_audio_cnn,
 
157
 
158
  predicted_label = predict_emotion(video_path, audio_path)
159
  emotion_dict = {0: 'neutral', 1: 'calm', 2: 'happy', 3: 'sad', 4: 'angry', 5: 'fearful'}
160
+
 
161
  # Định nghĩa giao diện Gradio
162
 
163
  def predict_emotion_gradio(video, audio):