Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ from joblib import load
|
|
11 |
import soundfile as sf
|
12 |
|
13 |
# Assuming you already have the 'ann_model' trained and 'pca' instance from the previous code
|
14 |
-
language_mapping = {'malayalam': 0, 'english': 1, 'tamil': 2,'hindi':3
|
15 |
|
16 |
class ANNModel(nn.Module):
|
17 |
def __init__(self):
|
@@ -20,7 +20,7 @@ class ANNModel(nn.Module):
|
|
20 |
self.relu1 = nn.ReLU()
|
21 |
self.fc2 = nn.Linear(128, 64)
|
22 |
self.relu2 = nn.ReLU()
|
23 |
-
self.fc3 = nn.Linear(64,
|
24 |
|
25 |
def forward(self, x):
|
26 |
x = self.fc1(x)
|
@@ -34,10 +34,10 @@ class ANNModel(nn.Module):
|
|
34 |
ann_model = ANNModel()
|
35 |
|
36 |
# Load the trained model
|
37 |
-
ann_model.load_state_dict(torch.load('
|
38 |
|
39 |
# Load the PCA instance
|
40 |
-
pca = load('
|
41 |
|
42 |
vgg16 = models.vgg16(pretrained=True).features
|
43 |
# Function to load and preprocess a single audio file
|
|
|
11 |
import soundfile as sf
|
12 |
|
13 |
# Assuming you already have the 'ann_model' trained and 'pca' instance from the previous code
|
14 |
+
language_mapping = {'malayalam': 0, 'english': 1, 'tamil': 2,'hindi':3}
|
15 |
|
16 |
class ANNModel(nn.Module):
|
17 |
def __init__(self):
|
|
|
20 |
self.relu1 = nn.ReLU()
|
21 |
self.fc2 = nn.Linear(128, 64)
|
22 |
self.relu2 = nn.ReLU()
|
23 |
+
self.fc3 = nn.Linear(64, 4)
|
24 |
|
25 |
def forward(self, x):
|
26 |
x = self.fc1(x)
|
|
|
34 |
ann_model = ANNModel()
|
35 |
|
36 |
# Load the trained model
|
37 |
+
ann_model.load_state_dict(torch.load('ann_model1.pth'))
|
38 |
|
39 |
# Load the PCA instance
|
40 |
+
pca = load('pca1.pkl')
|
41 |
|
42 |
vgg16 = models.vgg16(pretrained=True).features
|
43 |
# Function to load and preprocess a single audio file
|