Hi I tried to copy the clarifai doc to create a workflow
Below is my error code
---------------------------------------------------------------------------
_InactiveRpcError Traceback (most recent call last)
<ipython-input-23-3e79233b3dd8> in <module>
11 resources_pb2.Input(data=resources_pb2.Data(image=resources_pb2.Image(url='YOUR_IMAGE_URL')))
12 ])
---> 13 response = stub.PostModelOutputs(request, metadata=metadata)
14
15 if response.status.code != status_code_pb2.SUCCESS:
~\Anaconda3\lib\site-packages\grpc\_channel.py in __call__(self, request, timeout, metadata, credentials, wait_for_ready, compression)
824 raise StopIteration()
825 elif self._state.code is not None:
--> 826 raise self
827
828
~\Anaconda3\lib\site-packages\grpc\_channel.py in _end_unary_response_blocking(state, call, with_call, deadline)
727 def result(self, timeout=None):
728 """Returns the result of the computation or raises its exception.
--> 729
730 See grpc.Future.result for the full API contract.
731 """
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"@1618805454.368000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":4134,"referenced_errors":[{"created":"@1618805454.368000000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":398,"grpc_status":14}]}"
>
To create the error, API key is an example key
from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
from clarifai_grpc.grpc.api import service_pb2_grpc
stub = service_pb2_grpc.V2Stub(ClarifaiChannel.get_grpc_channel())
from clarifai_grpc.grpc.api import service_pb2, resources_pb2
from clarifai_grpc.grpc.api.status import status_code_pb2
# This is how you authenticate.
metadata = (('authorization', 'Key b66dddddddddddddddddddddddddd'),)
request = service_pb2.PostModelOutputsRequest(
# This is the model ID of a publicly available General model. You may use any other public or custom model ID.
model_id='aaa03c23b3724a16a56b629203edc62c',
inputs=[
resources_pb2.Input(data=resources_pb2.Data(image=resources_pb2.Image(url='YOUR_IMAGE_URL')))
])
response = stub.PostModelOutputs(request, metadata=metadata)
if response.status.code != status_code_pb2.SUCCESS:
raise Exception("Request failed, status code: " + str(response.status.code))
for concept in response.outputs[0].data.concepts:
print('%12s: %.2f' % (concept.name, concept.value))
I resort to grpc to solve the issue but cannot find the answer https://grpc.io/docs/languages/python/quickstart/ Any advice is appreciated