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
<nav class="navbar navbar-expand-custom navbar-mainbg"> | |
<a class="navbar-brand navbar-logo" href="#">Navbar</a> | |
<button class="navbar-toggler" type="button" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | |
<i class="fas fa-bars text-white"></i> | |
</button> | |
<div class="collapse navbar-collapse" id="navbarSupportedContent"> | |
<ul class="navbar-nav ml-auto"> | |
<div class="hori-selector"><div class="left"></div><div class="right"></div></div> | |
<li class="nav-item"> | |
<a class="nav-link" href="javascript:void(0);"><i class="fas fa-tachometer-alt"></i>Dashboard</a> |
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
resource "google_compute_instance" "default" { | |
project = var.project | |
name = "datastream-proxy" | |
machine_type = var.proxy_machine_type | |
zone = var.zone | |
boot_disk { | |
initialize_params { | |
image = "debian-cloud/debian-11" | |
} |
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
resource "google_datastream_private_connection" "default" { | |
project = var.project | |
display_name = "Private connection profile" | |
location = var.region | |
private_connection_id = "my-connection" | |
vpc_peering_config { | |
vpc = data.google_compute_network.network.id | |
subnet = "10.1.0.0/29" | |
} |
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
resource "google_compute_global_address" "private_ip_address" { | |
provider = google-beta | |
project = var.project | |
name = "private-ip-address" | |
purpose = "VPC_PEERING" | |
address_type = "INTERNAL" | |
prefix_length = 16 | |
network = data.google_compute_network.network.id | |
} |
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 | |
) |
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 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
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
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
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 |
NewerOlder