Update app.py
Browse files
app.py
CHANGED
@@ -77,13 +77,13 @@ def preprocess_single_audio_vgg16(audio_data, sr, vgg16_model, pca_instance):
|
|
77 |
|
78 |
def predict_language(audio_input):
|
79 |
# Load VGG16 model
|
80 |
-
|
81 |
# Load the audio file
|
82 |
-
|
83 |
-
|
84 |
# Get the sample rate and convert the audio data to float
|
85 |
-
|
86 |
-
|
87 |
|
88 |
# Preprocess the single audio file using VGG16 for feature extraction
|
89 |
preprocessed_features = preprocess_single_audio_vgg16(audio, sr, vgg16, pca)
|
|
|
77 |
|
78 |
def predict_language(audio_input):
|
79 |
# Load VGG16 model
|
80 |
+
if isinstance(audio_input, str):
|
81 |
# Load the audio file
|
82 |
+
audio, sr = librosa.load(audio_input, sr=None)
|
83 |
+
else:
|
84 |
# Get the sample rate and convert the audio data to float
|
85 |
+
sr, audio = audio_input
|
86 |
+
audio = audio.astype(np.float32)
|
87 |
|
88 |
# Preprocess the single audio file using VGG16 for feature extraction
|
89 |
preprocessed_features = preprocess_single_audio_vgg16(audio, sr, vgg16, pca)
|