Update app.py
Browse files
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(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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():
|