Hi there, I'm having a small problem with input ty...
# ask-for-help
v
Hi there, I'm having a small problem with input type for api
Copy code
class 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:
Copy code
AttributeError: type object 'bytes' has no attribute 'input_type'
You guys have any idea how to define bytes type?
j
Hello, would you like to tryout our 1.2 API? bytes is support there.
@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 types
v
Thanks. I'll give a try
Can you share documents about 1.2 API?
Can I batchable websocket method?
j
v
Can websocket method batchable?
j
bentoml doesn't not have websocket support for now
🥲 1