Created
September 8, 2022 13:05
-
-
Save marvinhoxha/d7f50d7f4350b5a13c0bc70d961d70e4 to your computer and use it in GitHub Desktop.
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) | |
image = input_arr[None, ...] | |
if config=="TENSORFLOW": | |
print("Tensorflow") | |
result = predict_tfserve(image) | |
elif config=="SELDON": | |
print("SELDON") | |
result = predict_seldon(image) | |
send_photo_to_slack(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment