Add custom handler for TTS inference
Browse files- handler.py +3 -1
handler.py
CHANGED
|
@@ -66,9 +66,11 @@ class EndpointHandler:
|
|
| 66 |
with torch.no_grad():
|
| 67 |
out = self.model.generate(
|
| 68 |
**inputs,
|
| 69 |
-
speaker=speaker, # Explicitly pass speaker to model
|
| 70 |
max_length=max_length,
|
| 71 |
output_audio=True, # CSM returns audio
|
|
|
|
|
|
|
|
|
|
| 72 |
)
|
| 73 |
|
| 74 |
# Convert to base64 WAV for the endpoint response
|
|
|
|
| 66 |
with torch.no_grad():
|
| 67 |
out = self.model.generate(
|
| 68 |
**inputs,
|
|
|
|
| 69 |
max_length=max_length,
|
| 70 |
output_audio=True, # CSM returns audio
|
| 71 |
+
do_sample=True,
|
| 72 |
+
temperature=0.8,
|
| 73 |
+
top_p=0.9,
|
| 74 |
)
|
| 75 |
|
| 76 |
# Convert to base64 WAV for the endpoint response
|