Vương Nguyễn
05/01/2024, 6:26 AMclass SpeechRecognizerRunnable(bentoml.Runnable):
SUPPORTED_RESOURCES = ("<http://nvidia.com/gpu|nvidia.com/gpu>",)
SUPPORTS_CPU_MULTI_THREADING = True
def __init__(self) -> None:
self.__asr_model = ASRModel(model_size="medium")
self.__vad_model = VADModel()
@bentoml.Runnable.method(batchable=True, batch_dim=0)
def predict(self, audio_bytes: bytes) -> str:
return audio_transcriber(audio_bytes, self.__asr_model, self.__vad_model)
asr_runner = bentoml.Runner(SpeechRecognizerRunnable)
svc = bentoml.Service("asr_service", runners= [asr_runner])
@svc.api(input=bytes, output=str) # Error right here
async def transcribe(audio_bytes: bytes) -> str:
text = await asr_runner.predict.async_run(audio_bytes)
return text
And I got:
AttributeError: type object 'bytes' has no attribute 'input_type'
You guys have any idea how to define bytes type?Jian Shen Yap
05/01/2024, 2:16 PM@svc.api(input=bytes, output=str) # Error right here
This is a 1.1 API, which requires you to use IO descriptors instead of python typesVương Nguyễn
05/09/2024, 2:16 AMVương Nguyễn
05/09/2024, 2:18 AMVương Nguyễn
05/09/2024, 8:37 AMJian Shen Yap
05/09/2024, 8:48 AMVương Nguyễn
05/09/2024, 9:05 AMJian Shen Yap
05/09/2024, 9:06 AM