dthomas84 commited on
Commit
7f4e651
1 Parent(s): dffe189

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +5 -2
handler.py CHANGED
@@ -32,7 +32,7 @@ class EndpointHandler:
32
  if audio is not None:
33
  audio_list = json.loads(audio)
34
  audio_array = np.array(audio_list)
35
- parameters["audio"] = audio_array
36
 
37
  if duration is not None:
38
  # Calculate max new tokens based on duration, this is a placeholder, replace with actual logic
@@ -44,11 +44,14 @@ class EndpointHandler:
44
  inputs = self.processor(
45
  text=[inputs],
46
  padding=True,
47
- return_tensors="pt",).to(self.device)
 
48
 
49
  # If 'duration' is inside 'parameters', remove it
50
  if parameters is not None and 'duration' in parameters:
51
  parameters.pop('duration')
 
 
52
 
53
  # pass inputs with all kwargs in data
54
  if parameters is not None:
 
32
  if audio is not None:
33
  audio_list = json.loads(audio)
34
  audio_array = np.array(audio_list)
35
+ audio = audio_array
36
 
37
  if duration is not None:
38
  # Calculate max new tokens based on duration, this is a placeholder, replace with actual logic
 
44
  inputs = self.processor(
45
  text=[inputs],
46
  padding=True,
47
+ return_tensors="pt",
48
+ audio=audio).to(self.device)
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: