Clarifai / clarifai-python-grpc

Clarifai gRPC Python API client
https://docs.clarifai.com
Other
56 stars 20 forks source link

[TRI-2511] :bug: Fix `KeyError: 'data'` #82

Closed moldovan-clarifai closed 2 years ago

moldovan-clarifai commented 2 years ago

Steps to Replicate

from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
from clarifai_grpc.grpc.api import service_pb2_grpc, service_pb2, resources_pb2

stub = service_pb2_grpc.V2Stub(ClarifaiChannel.get_json_channel())

if __name__ == '__main__':
  YOUR_CLARIFAI_API_KEY = 'KEY'
  auth_metadata = (('authorization', f'Key {YOUR_CLARIFAI_API_KEY}'),)

  resp = stub.PostModelOutputs(service_pb2.PostModelOutputsRequest(
    user_app_id=resources_pb2.UserAppIDSet(
      user_id='user-id',
      app_id='app-id',
    ),
    model_id='model-id',
    inputs=[resources_pb2.Input(
      id="input-id"
    )]
  ), metadata=auth_metadata)
  print(resp)

Expected

Actual