File tree 1 file changed +12
-8
lines changed
1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 10
10
from contextlib import contextmanager
11
11
from os import listdir
12
12
from os .path import isfile , join
13
+ from sys import platform
13
14
14
15
import soundfile as sf
15
16
import numpy as np
@@ -21,15 +22,18 @@ class TimeoutException(Exception): pass
21
22
22
23
@contextmanager
23
24
def time_limit (seconds ):
24
- def signal_handler (signum , frame ):
25
- raise TimeoutException ("Prediction timed out!" )
26
-
27
- signal .signal (signal .SIGALRM , signal_handler )
28
- signal .alarm (seconds )
29
- try :
25
+ if platform != "win32" :
26
+ def signal_handler (signum , frame ):
27
+ raise TimeoutException ("Prediction timed out!" )
28
+
29
+ signal .signal (signal .SIGALRM , signal_handler )
30
+ signal .alarm (seconds )
31
+ try :
32
+ yield
33
+ finally :
34
+ signal .alarm (0 )
35
+ else :
30
36
yield
31
- finally :
32
- signal .alarm (0 )
33
37
34
38
35
39
class MusicDemixingPredictor :
You can’t perform that action at this time.
0 commit comments