File size: 609 Bytes
d5bc153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from model import DID_Model
import torch


device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
aud_path = r"uploads\L.wav"
wave2vec_model_path = r"model_snapshots\wav2vec2_model.pth"
model_path = r"model_snapshots\Marathi_Model_Snapshot.pth"



if __name__ == "__main__":
    # Load the Wav2Vec 2.0 model from torchaudio pipelines

    # Load custom dialect identification model
    model = DID_Model()
    model.load_weights(model_path, wave2vec_model_path )
    # Predict dialect
    predicted_dialect = model.predict_dialect(aud_path) #
    print("Predicted Dialect:", predicted_dialect)