Update handler.py
Browse files- handler.py +5 -1
handler.py
CHANGED
@@ -28,6 +28,7 @@ class EndpointHandler:
|
|
28 |
parameters = data.pop("parameters", None)
|
29 |
duration = parameters.pop("duration", None)
|
30 |
audio = parameters.pop("audio", None)
|
|
|
31 |
|
32 |
if audio is not None:
|
33 |
audio_list = json.loads(audio)
|
@@ -45,13 +46,16 @@ class EndpointHandler:
|
|
45 |
text=[inputs],
|
46 |
padding=True,
|
47 |
return_tensors="pt",
|
48 |
-
audio=audio
|
|
|
49 |
|
50 |
# If 'duration' is inside 'parameters', remove it
|
51 |
if parameters is not None and 'duration' in parameters:
|
52 |
parameters.pop('duration')
|
53 |
if parameters is not None and 'audio' in parameters:
|
54 |
parameters.pop('audio')
|
|
|
|
|
55 |
|
56 |
# pass inputs with all kwargs in data
|
57 |
if parameters is not None:
|
|
|
28 |
parameters = data.pop("parameters", None)
|
29 |
duration = parameters.pop("duration", None)
|
30 |
audio = parameters.pop("audio", None)
|
31 |
+
sampling_rate = parameters.pop("sampling_rate", None)
|
32 |
|
33 |
if audio is not None:
|
34 |
audio_list = json.loads(audio)
|
|
|
46 |
text=[inputs],
|
47 |
padding=True,
|
48 |
return_tensors="pt",
|
49 |
+
audio=audio,
|
50 |
+
sampling_rate=sampling_rate).to(self.device)
|
51 |
|
52 |
# If 'duration' is inside 'parameters', remove it
|
53 |
if parameters is not None and 'duration' in parameters:
|
54 |
parameters.pop('duration')
|
55 |
if parameters is not None and 'audio' in parameters:
|
56 |
parameters.pop('audio')
|
57 |
+
if parameters is not None and 'sampling_rate' in parameters:
|
58 |
+
parameters.pop('sampling_rate')
|
59 |
|
60 |
# pass inputs with all kwargs in data
|
61 |
if parameters is not None:
|