Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Is there a gRPC python script with SSL

Scuba
Beginner
1,188 Views

I was going through https://docs.openvino.ai/nightly/ovms_docs_deploying_server.html 

Item 3

I updated the script predict.py so that it can work with SSL

I am getting this error

python3 predict.py zebra.jpeg

Traceback (most recent call last):

  File "//predict.py", line 4, in <module>

    from ovmsclient.generated import ovms_pb2, ovms_pb2_grpc

ModuleNotFoundError: No module named 'ovmsclient.generated'

(

(tutorial-env) root@ubuntu:/# cat predict.py

import numpy as np

from classes import imagenet_classes

import grpc

from ovmsclient.generated import ovms_pb2, ovms_pb2_grpc

 

# Set up SSL/TLS credentials

credentials = grpc.ssl_channel_credentials()

 

# Create a secure channel to the gRPC server

channel = grpc.secure_channel("10.1.1.7:443", credentials)

 

# Create a gRPC stub

stub = ovms_pb2_grpc.OpenVinoModelServerStub(channel)

 

# Read image file

with open("zebra.jpeg", "rb") as f:

        img = f.read()

 

# Make prediction request to the specified model

request = ovms_pb2.PredictRequest()

request.inputs["0"].data = img

request.model_spec.name = "resnet"

 

# Send the request and get the response

response = stub.Predict(request)

 

# Handle the prediction output

if response:

    result_index = np.argmax(response.outputs["1"].data)

    predicted_class = imagenet_classes[result_index]

    print("Predicted class:", predicted_class)

else:

    print("No prediction output received.")

(tutorial-env) root@ubuntu:/#

Labels (3)
0 Kudos
4 Replies
Wan_Intel
Moderator
1,117 Views

Hi Scuba,

Thanks for reaching out to us.

 

We'll further investigate the issue and we'll update you as soon as possible. On the other hand, could you please share the following information with us?

  • Which options did you choose to deploy the OpenVINO™ Model Server?
  • Which operating system are you using when deploying the OpenVINO™ Model Server?

 

 

Regards,

Wan

0 Kudos
Scuba
Beginner
1,060 Views
  • Which options did you choose to deploy the OpenVINO™ Model Server?

Container option :https://docs.openvino.ai/nightly/ovms_docs_deploying_server.html

  • Which operating system are you using when deploying the OpenVINO™ Model Server?

AWS Ec2

 

0 Kudos
Wan_Intel
Moderator
989 Views

Hi Scuba,

Thanks for your patience.

 

I’ve deployed the OpenVINO™ Model Server in a Docker Container using the option that you shared hereI’ve validated the example from here that launched the OpenVINO™ Model Server with a ResNet50 image classification model from a cloud storage.

 

For your information, the error you encountered: ModuleNotFoundError: No module named ‘ovmsclient.generated’ when running from ovmsclient.generated import ovms_pb2, ovms_pb2_grpc is expected because the generated module is not available at ovmsclient package.

 

ovmsclient.jpg

 

Sorry for the inconvenience and thank you for your support.

 

 

Regards,

Wan

 

0 Kudos
Wan_Intel
Moderator
676 Views

Hi Scuba,

Thanks for your question.

If you need additional information from Intel, please submit a new question as this thread will no longer be monitored.

Regards,

Wan​

 

0 Kudos
Reply