Update app.py
Browse files
app.py
CHANGED
@@ -64,10 +64,10 @@ def predict_class(file_path, model, label_encoder):
|
|
64 |
try:
|
65 |
# Extract and prepare features
|
66 |
features = extract_features(file_path)
|
67 |
-
|
68 |
|
69 |
# Make prediction
|
70 |
-
prediction = model.predict(
|
71 |
predicted_index = np.argmax(prediction)
|
72 |
|
73 |
# Map predicted index to class label
|
@@ -77,6 +77,7 @@ def predict_class(file_path, model, label_encoder):
|
|
77 |
return f"Error in prediction: {str(e)}"
|
78 |
|
79 |
|
|
|
80 |
# Load Pre-trained Model
|
81 |
model = tf.keras.models.load_model("voice_classification_modelm.h5")
|
82 |
|
|
|
64 |
try:
|
65 |
# Extract and prepare features
|
66 |
features = extract_features(file_path)
|
67 |
+
input_vector = prepare_input(features)
|
68 |
|
69 |
# Make prediction
|
70 |
+
prediction = model.predict(input_vector)
|
71 |
predicted_index = np.argmax(prediction)
|
72 |
|
73 |
# Map predicted index to class label
|
|
|
77 |
return f"Error in prediction: {str(e)}"
|
78 |
|
79 |
|
80 |
+
|
81 |
# Load Pre-trained Model
|
82 |
model = tf.keras.models.load_model("voice_classification_modelm.h5")
|
83 |
|