This file contains 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 android.app.Activity; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.wearable.view.WearableListView; | |
import android.util.Log; | |
import android.view.LayoutInflater; | |
import android.view.ViewGroup; | |
import android.widget.TextView; |
This file contains 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
application: YOUR_APP_NAME_HERE | |
version: 1 | |
runtime: python27 | |
api_version: 1 | |
threadsafe: true | |
handlers: | |
- url: /.* | |
script: oauth.application | |
This file contains 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
''' SHALLOW MODEL ''' | |
img_shape = (32, 32, 3) | |
z_dim = 100 | |
init = initializers.RandomNormal(mean=0.0, stddev=0.02) | |
opt = Adam(lr=0.0002, beta_1=0.5) | |
def build_discriminator(in_shape=img_shape): | |
model = Sequential() | |
model.add(Conv2D(64, (5,5), input_shape=in_shape, kernel_initializer=init)) |
This file contains 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
''' client to produce generator images from latent space ''' | |
import numpy as np | |
from keras.models import load_model | |
MODEL = './generator_model_2800.h5' | |
z_noise = np.random.randn(100*25) | |
z_noise = z_noise.reshape(25, 100) | |
model = load_model(MODEL) |
This file contains 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 keras.applications.vgg16 import VGG16 | |
model = VGG16(weights='imagenet') | |
model.save('model_vgg16_imagenet.h5') | |
print('Pre-trained VGG16 model with ImageNet weights saved!') |
This file contains 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 os | |
import numpy as np | |
import tensorflow as tf | |
from keras.applications.vgg16 import preprocess_input, decode_predictions | |
from keras.models import load_model | |
from keras.preprocessing.image import img_to_array, load_img | |
from flask import Flask, redirect, url_for, request, render_template | |
# define a Flask app | |
app = Flask(__name__) |
This file contains 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
# Make predictions on unseen data | |
# | |
# follows my full demo/repo at | |
# https://github.com/jasonsalas/nlp_predict_movie_rating_via_description/ | |
import pickle | |
from keras.preprocessing.text import Tokenizer | |
from keras.models import load_model | |
''' Cabin in the Woods (R) ''' |
This file contains 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 numpy as np | |
import sys | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, LSTM | |
from keras.callbacks import ModelCheckpoint | |
from keras.utils import to_categorical | |
filename = 'dm_lyrics.txt' | |
raw_text = open(filename, 'r', encoding='utf-8').read() | |
raw_text = raw_text.lower() |
This file contains 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 numpy as np | |
import sys | |
from keras.models import Sequential | |
filename = 'trained_depechemode_lyrics_model.h5' | |
model = Sequential() | |
model.load_weights(filename) | |
model.compile(loss='categorical_crossentropy', optimizer='adam') |
This file contains 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
/* using worker pools & buffered channels in Go */ | |
// h/t: Naveen Ramanathan @ golangbot.com | |
// https://golangbot.com/buffered-channels-worker-pools/ | |
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sync" |
OlderNewer