ameliabb0913 commited on
Commit
917b126
·
verified ·
1 Parent(s): 46d2dd2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -26,6 +26,7 @@ def classify_emotion(audio_file):
26
  # Load and process audio
27
  speech, sr = librosa.load(audio_file, sr=16000)
28
  inputs = processor(speech, sampling_rate=16000, return_tensors="pt", padding=True, truncation=True)
 
29
 
30
  # Get predictions
31
  with torch.no_grad():
 
26
  # Load and process audio
27
  speech, sr = librosa.load(audio_file, sr=16000)
28
  inputs = processor(speech, sampling_rate=16000, return_tensors="pt", padding=True, truncation=True)
29
+ inputs["input_values"] = inputs["input_values"].unsqueeze(0) # Add batch dimension
30
 
31
  # Get predictions
32
  with torch.no_grad():