skroed commited on
Commit
1c28486
1 Parent(s): e1735f5

Fix: endpoint passing speaker.

Browse files
Files changed (1) hide show
  1. handler.py +12 -9
handler.py CHANGED
@@ -20,15 +20,18 @@ class EndpointHandler:
20
  """
21
  # process input
22
  text = data.pop("inputs", data)
23
- parameters = data.get("parameters", None)
24
- if parameters is None:
25
- parameters = {}
26
- # preprocess
27
- inputs = self.processor(
28
- text=[text],
29
- return_tensors="pt",
30
- voice_preset=parameters.get("voice_preset", None),
31
- ).to("cuda")
 
 
 
32
 
33
  with torch.autocast("cuda"):
34
  outputs = self.model.generate(**inputs)
 
20
  """
21
  # process input
22
  text = data.pop("inputs", data)
23
+ voice_preset = data.get("voice_preset", None)
24
+ if voice_preset:
25
+ inputs = self.processor(
26
+ text=[text],
27
+ return_tensors="pt",
28
+ voice_preset=voice_preset,
29
+ ).to("cuda")
30
+ else:
31
+ inputs = self.processor(
32
+ text=[text],
33
+ return_tensors="pt",
34
+ ).to("cuda")
35
 
36
  with torch.autocast("cuda"):
37
  outputs = self.model.generate(**inputs)