Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,12 @@ if audio_file is not None:
|
|
40 |
inputs = feature_extractor(clip.squeeze().numpy(), return_tensors="pt")
|
41 |
input_features = inputs.input_features
|
42 |
|
43 |
-
#
|
44 |
if input_features.shape[-1] < 3000:
|
45 |
pad_length = 3000 - input_features.shape[-1]
|
46 |
-
input_features = torch.nn.functional.pad(input_features, (0, pad_length))
|
|
|
|
|
47 |
|
48 |
# Measure inference time
|
49 |
start_time = time.time()
|
|
|
40 |
inputs = feature_extractor(clip.squeeze().numpy(), return_tensors="pt")
|
41 |
input_features = inputs.input_features
|
42 |
|
43 |
+
# Ensure input features have the required length of 3000
|
44 |
if input_features.shape[-1] < 3000:
|
45 |
pad_length = 3000 - input_features.shape[-1]
|
46 |
+
input_features = torch.nn.functional.pad(input_features, (0, pad_length), mode='constant', value=0)
|
47 |
+
elif input_features.shape[-1] > 3000:
|
48 |
+
input_features = input_features[:, :, :3000]
|
49 |
|
50 |
# Measure inference time
|
51 |
start_time = time.time()
|