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
| echo Hello world | |
| echo "Hello" | |
| ## you can also print out the file without specifically open it | |
| cat nama_file.txt |
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 vad_collector(sample_rate, frame_duration_ms, padding_duration_ms, vad, frames): | |
| triggered = False | |
| voiced_frames = [] | |
| for frame in frames: | |
| is_speech = vad.is_speech(frame.bytes, sample_rate) | |
| sys.stdout.write('1' if is_speech else '0') | |
| if not triggered: | |
| ring_buffer.append((frame, is_speech)) |
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
| vad = webrtcvad.Vad(int(args[0])) | |
| print("Generating Frames...") | |
| frames = frame_generator(30, audio, sample_rate) | |
| frames = list(frames) |
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
| print("Reading file:", args[1]) | |
| print("aggressiveness:", args[0]) | |
| audio, sample_rate = read_wave(args[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
| if len(args) != 2: | |
| sys.stderr.write( | |
| 'Usage: example.py <aggressiveness> <path to wav file>\n') | |
| sys.exit(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
| ph = tf.placeholder(tf.int32) | |
| sess = tf.Session() | |
| sess.run(ph, feed_dict={ph: [9,8,7]}) | |
| #array([9, 8, 7], dtype=int32) |
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
| d = tf.Variable([3,4,5]) | |
| init_op = tf.global_variables_initializer() | |
| sess = tf.Session() | |
| sess.run(init_op) | |
| sess.run(d) | |
| #array([4, 5, 6], dtype=int32) |
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 | |
| a_const = tf.constant([1,2,3]) | |
| sess = tf.Session() | |
| sess.run(a_const) | |
| #array([1, 2, 3], dtype=int32) |
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
| %%time | |
| kmeans_endpoint = 'topic-kmeans-endpoint' | |
| print(kmeans_endpoint) | |
| create_endpoint_response = sm.create_endpoint( | |
| EndpointName = kmeans_endpoint, | |
| EndpointConfigName = kmeans_endpoint_config) | |
| print(create_endpoint_response['EndpointArn']) |
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
| kmeans_endpoint_config = 'topic-kmeans-config' | |
| print(kmeans_endpoint_config) | |
| create_endpoint_config_response = sm.create_endpoint_config( | |
| EndpointConfigName = kmeans_endpoint_config, | |
| ProductionVariants = [{'InstanceType' : 'ml.m4.xlarge', | |
| 'InitialInstanceCount': 1, | |
| 'ModelName' : kmeans_model, | |
| 'VariantName' : 'AllTraffic'} | |
| ]) |