Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ def get_emotion(microphone, file_upload, task):
|
|
17 |
elif (microphone is None) and (file_upload is None):
|
18 |
return "ERROR: You have to either use the microphone or upload an audio file"
|
19 |
|
20 |
-
model = torch.load('model.pth'
|
21 |
file = microphone if microphone is not None else file_upload
|
22 |
speech, _ = librosa.load(file, sr=16000, mono=True)
|
23 |
test = feature_extractor(speech, sampling_rate=16000, padding=True, return_tensors="pt" )
|
|
|
17 |
elif (microphone is None) and (file_upload is None):
|
18 |
return "ERROR: You have to either use the microphone or upload an audio file"
|
19 |
|
20 |
+
model = torch.load('model.pth', map_location=torch.device('cpu'))
|
21 |
file = microphone if microphone is not None else file_upload
|
22 |
speech, _ = librosa.load(file, sr=16000, mono=True)
|
23 |
test = feature_extractor(speech, sampling_rate=16000, padding=True, return_tensors="pt" )
|