Created
September 8, 2022 13:12
-
-
Save marvinhoxha/0c49f801a2faaed1ba97a522713d98b6 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
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) | |
if __name__ == "__main__": | |
image_producer() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment