(self, request, context)
| 744 | return backend_pb2.Result(success=False, message=f"Error generating TTS: {err}") |
| 745 | |
| 746 | def TokenizeString(self, request, context): |
| 747 | if not hasattr(self, 'tokenizer') or self.tokenizer is None: |
| 748 | context.set_code(grpc.StatusCode.FAILED_PRECONDITION) |
| 749 | context.set_details("Model/tokenizer not loaded") |
| 750 | return backend_pb2.TokenizationResponse() |
| 751 | try: |
| 752 | tokens = self.tokenizer.encode(request.Prompt) |
| 753 | return backend_pb2.TokenizationResponse(length=len(tokens), tokens=tokens) |
| 754 | except Exception as e: |
| 755 | context.set_code(grpc.StatusCode.INTERNAL) |
| 756 | context.set_details(str(e)) |
| 757 | return backend_pb2.TokenizationResponse() |
| 758 | |
| 759 | def Free(self, request, context): |
| 760 | try: |
nothing calls this directly
no test coverage detected