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
| wget -qO - http://packages.confluent.io/deb/3.1/archive.key | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] http://packages.confluent.io/deb/3.1 stable main" | |
| # Starting Confluent with | |
| cd <path to your Confluent Installation>/bin/ | |
| ./confluent start |
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
| import tensorflow as tf | |
| from tensorflow.python.saved_model import signature_constants | |
| from tensorflow.python.saved_model import tag_constants | |
| import argparse | |
| export_dir = 'models/1' | |
| builder = tf.saved_model.builder.SavedModelBuilder(export_dir) | |
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
| docker run -p 8501:8501 --mount type=bind,source=/path/to/my_model/,target=/models/my_model \ | |
| -e MODEL_NAME=my_model -t tensorflow/serving |
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
| docker run -p 8500:8500 --mount type=bind,source=/home/sfx/models/,target=/models/2 -e MODEL_NAME=2 -t tensorflow/serving | |
| #please change the /home/sfx/models absolute path of model on your server |
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_field = {"Message": fields.String, | |
| "Image_Embedding": fields.List(fields.String), | |
| "ID_Embedding": fields.List(fields.String), | |
| "Confidence": fields.String, | |
| "Round Trip Time": fields.String, | |
| "Process First Image Time": fields.String, | |
| "Process Second Image Time": fields.String, | |
| "Generate and Compare Time": fields.String} | |
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_field = {"Message": fields.String, | |
| "Image_Embedding": fields.List(fields.String), | |
| "ID_Embedding": fields.List(fields.String), | |
| "Confidence": fields.String, | |
| "Round Trip Time": fields.String, | |
| "Process First Image Time": fields.String, | |
| "Process Second Image Time": fields.String, | |
| "Generate and Compare Time": fields.String} | |
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
| scala> val examplelist = List(1, 2, 3, 4, 5) | |
| examplelist: List[Int] = List(1, 2, 3, 4, 5) | |
| scala> examplelist.map(x => List(x*x)) | |
| res1: List[List[Int]] = List(List(1), List(4), List(9), List(16), List(25)) | |
| scala> examplelist.flatMap(x => List(x*x)) | |
| res4: List[Int] = List(1, 4, 9, 16, 25) |
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
| dataset = generate(tfrecordfiles) | |
| IM_SIZE = 224 # image size | |
| image_input = tf.keras.Input(shape=(IM_SIZE, IM_SIZE, 3), name='input_layer') | |
| # Some convolutional layers | |
| conv_1 = tf.keras.layers.Conv2D(32, | |
| kernel_size=(3, 3), | |
| padding='same', | |
| activation='relu')(image_input) | |
| conv_1 = tf.keras.layers.MaxPooling2D(padding='same')(conv_1) |
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
| val conf = new SparkConf().setMaster("local[*").setAppName("simple-app") | |
| val sparkContext = new SparkContext(conf) | |
| //Loading data with Spark Context returns an RDD | |
| val rdd: RDD[String] = sparkContext.textFile("textfile.csv") | |
| //Also you can create an RDD by parallizing an existing Data | |
| val data: Array[Int] = Array(1, 2, 3, 4, 5, 6, 6, 7, 7) |
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
| val spark: SparkSession = SparkSession.builder() | |
| .master("local[*]") | |
| .appName("simple-app") | |
| .getOrCreate() | |
| val dataSet: Dataset[String] = spark.read.textFile("textfile.csv") | |
| val df: DataFrame = dataSet.toDF() |