ameliabb0913 commited on
Commit
1337340
·
verified ·
1 Parent(s): 2f7eb6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -25,7 +25,15 @@ id2label = {
25
  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():
 
25
  def classify_emotion(audio_file):
26
  # Load and process audio
27
  speech, sr = librosa.load(audio_file, sr=16000)
28
+ inputs = processor(
29
+ speech,
30
+ sampling_rate=16000,
31
+ return_tensors="pt",
32
+ padding="max_length",
33
+ truncation=True,
34
+ max_length=48000 # You can adjust this depending on expected audio length
35
+ )
36
+
37
 
38
  # Get predictions
39
  with torch.no_grad():