This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.8 | |
| EXPOSE 8502 | |
| WORKDIR /app | |
| ARG CONFIG | |
| ENV CONFIG ${CONFIG} | |
| ARG ENV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.8 | |
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive && apt-get install -y \ | |
| curl \ | |
| python3-setuptools && \ | |
| apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* | |
| RUN mkdir /models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.9" | |
| services: | |
| tfserve: | |
| image: tensorflow/serving | |
| ports: | |
| - 8501:8501 | |
| environment: | |
| MODEL_NAME: dog_model | |
| volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| repositories: | |
| - name: datawire | |
| url: https://www.getambassador.io | |
| - name: seldon | |
| url: https://storage.googleapis.com/seldon-charts | |
| releases: | |
| - name: ambassador | |
| namespace: ambassador | |
| createNamespace: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.8 | |
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive && \ | |
| apt-get install -y curl python3-setuptools && \ | |
| apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* | |
| RUN mkdir /models | |
| WORKDIR /app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resnet_body = tf.keras.applications.ResNet50V2( | |
| weights="imagenet", | |
| include_top=False, | |
| input_shape=(int(IMG_SIZE), int(IMG_SIZE), 3), | |
| ) | |
| resnet_body.trainable = False | |
| inputs = tf.keras.layers.Input(shape=(int(IMG_SIZE), int(IMG_SIZE), 3)) | |
| x = resnet_body(inputs, training=False) | |
| x = tf.keras.layers.Flatten()(x) | |
| outputs = tf.keras.layers.Dense(133, activation="softmax")(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def send_client_request(seldon_client, image): | |
| client_prediction = seldon_client.predict( | |
| data=image, | |
| deployment_name="seldon-dogbreed", | |
| payload_type="ndarray", | |
| ) | |
| return client_prediction | |
| if env == "COMPOSE": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def consumer(): | |
| consumer = KafkaConsumer('dogtopic') | |
| for message in consumer: | |
| with open("foo.png","wb") as f: | |
| f.write(decodebytes(message.value)) | |
| img = tf.keras.utils.load_img( | |
| "foo.png", | |
| target_size=(224,224) | |
| ) | |
| input_arr = tf.keras.utils.img_to_array(img) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from kafka import KafkaProducer | |
| import base64 | |
| def image_producer(): | |
| producer = KafkaProducer(bootstrap_servers='localhost:9092') | |
| with open("./dogImages/test/002.Afghan_hound/Afghan_hound_00116.jpg", "rb") as imageFile: | |
| str1 = base64.b64encode(imageFile.read()) | |
| producer.send('dogtopic', str1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def send_photo_to_slack(result): | |
| image = open("foo.png", 'rb').read() | |
| client = WebClient("Slack_Bot_User_OAuth_Token") #input OAuth token | |
| client.files_upload( | |
| channels = "Slack_channel_id", #input channel id | |
| initial_comment = f"{result}", | |
| filename = "dog photo", | |
| content = image | |
| ) |
OlderNewer