Dupaja commited on
Commit
c0208f8
·
1 Parent(s): f503fca

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +11 -2
handler.py CHANGED
@@ -39,9 +39,16 @@ class EndpointHandler:
39
 
40
  inputs = self.processor(text=given_text, return_tensors="pt")
41
 
 
 
 
 
42
  speech = self.model.generate_speech(inputs["input_ids"], self.speaker_embeddings, vocoder=self.vocoder)
 
 
 
 
43
 
44
- run_time = time.time() - start_time
45
 
46
  # Return the expected response format
47
  return {
@@ -49,7 +56,9 @@ class EndpointHandler:
49
  "body": {
50
  "audio": speech.numpy(), # Consider encoding this to a suitable format
51
  "sampling_rate": 16000,
52
- "time_to_generate": str(run_time)
 
 
53
  }
54
  }
55
 
 
39
 
40
  inputs = self.processor(text=given_text, return_tensors="pt")
41
 
42
+ run_time_processor = time.time() - start_time
43
+
44
+ start_time_speech = time.time()
45
+
46
  speech = self.model.generate_speech(inputs["input_ids"], self.speaker_embeddings, vocoder=self.vocoder)
47
+
48
+ run_time_speech = time.time() - start_time_speech
49
+
50
+ run_time_total = time.time() - start_time
51
 
 
52
 
53
  # Return the expected response format
54
  return {
 
56
  "body": {
57
  "audio": speech.numpy(), # Consider encoding this to a suitable format
58
  "sampling_rate": 16000,
59
+ "run_time_processor": str(run_time_processor),
60
+ "run_time_speech": str(run_time_processor),
61
+ "run_time_total": str(run_time_processor),
62
  }
63
  }
64