aiplexdeveloper commited on
Commit
4106de1
·
verified ·
1 Parent(s): 002833d

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -1
handler.py CHANGED
@@ -25,6 +25,8 @@ class EndpointHandler():
25
 
26
  # Concatenate all audio segments
27
  full_audio = torch.cat([torch.tensor(a) for a in audio_segments])
 
 
28
 
29
  # Write full audio to a binary buffer
30
  buffer = io.BytesIO()
@@ -39,5 +41,6 @@ class EndpointHandler():
39
  },
40
  "body": audio_b64,
41
  "statusCode": 200,
42
- "isBase64Encoded": True # if binary, encode
 
43
  }
 
25
 
26
  # Concatenate all audio segments
27
  full_audio = torch.cat([torch.tensor(a) for a in audio_segments])
28
+
29
+ audio_length_seconds = len(full_audio) / sample_rate
30
 
31
  # Write full audio to a binary buffer
32
  buffer = io.BytesIO()
 
41
  },
42
  "body": audio_b64,
43
  "statusCode": 200,
44
+ "isBase64Encoded": True,
45
+ "audio_length_seconds": audio_length_seconds
46
  }