apenasissso commited on
Commit
2ca4eb5
1 Parent(s): 1c732f7

Ensure last chunk is 10 seconds long

Browse files
Files changed (2) hide show
  1. handler.py +2 -0
  2. test_handler.py +1 -1
handler.py CHANGED
@@ -29,6 +29,8 @@ def save_chunks_to_temp_files(url, chunk_length=10000): # chunk_length in milli
29
  for i in range(0, len(audio_segment), chunk_length)
30
  ]
31
 
 
 
32
  # Save each chunk to a temporary file and store file paths in a list
33
  temp_files = []
34
  for idx, chunk in enumerate(chunks):
 
29
  for i in range(0, len(audio_segment), chunk_length)
30
  ]
31
 
32
+ chunks[-1] = audio_segment[-chunk_length:] # Ensure last chunk is 10 seconds long
33
+
34
  # Save each chunk to a temporary file and store file paths in a list
35
  temp_files = []
36
  for idx, chunk in enumerate(chunks):
test_handler.py CHANGED
@@ -5,7 +5,7 @@ my_handler = EndpointHandler()
5
 
6
  # prepare sample payload
7
  holiday_payload = {
8
- "inputs": "https://pl-bots-public-media.s3.amazonaws.com/5511976170855_daa87950-5e1b-49e0-9daf-ba73d568a291.mp3"
9
  }
10
 
11
  # test the handler
 
5
 
6
  # prepare sample payload
7
  holiday_payload = {
8
+ "inputs": "https://pl-bots-public-media.s3.amazonaws.com/14153496170_fcc9fd77-7159-4777-b008-4360bc2b5f84.mp3"
9
  }
10
 
11
  # test the handler