Rails flash messages with AJAX requests
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
# Compatibility imports | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
import time | |
import tensorflow as tf | |
import scipy.io.wavfile as wav | |
import numpy as np |
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 tensorflow as tf | |
def beam_decoder(decoder_inputs, initial_state, cell, loop_function, scope=None, | |
beam_size=7, done_token=0 | |
): | |
""" | |
Beam search decoder | |
Args: | |
decoder_inputs: A list of 2D Tensors [batch_size x input_size]. |
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
# variation to https://github.com/ryankiros/skip-thoughts/blob/master/decoding/search.py | |
def keras_rnn_predict(samples, empty=empty, rnn_model=model, maxlen=maxlen): | |
"""for every sample, calculate probability for every possible label | |
you need to supply your RNN model and maxlen - the length of sequences it can handle | |
""" | |
data = sequence.pad_sequences(samples, maxlen=maxlen, value=empty) | |
return rnn_model.predict(data, verbose=0) | |
def beamsearch(predict=keras_rnn_predict, |
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
# Working example for my blog post at: | |
# http://danijar.com/introduction-to-recurrent-networks-in-tensorflow/ | |
import functools | |
import sets | |
import tensorflow as tf | |
from tensorflow.models.rnn import rnn_cell | |
from tensorflow.models.rnn import rnn | |
def lazy_property(function): |
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
require 'fileutils' | |
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku. | |
# The deploy branch is rebased onto master, so the push needs to be forced. | |
desc "Deploy app to Heroku after precompiling assets" | |
task :deploy do | |
deploy_branch = 'heroku' | |
remote = 'heroku' | |
deploy_repo_dir = "tmp/heroku_deploy" |
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
#!/bin/bash | |
# Add some PPAs | |
sudo add-apt-repository -y ppa:webupd8team/sublime-text-2 #sublime text | |
sudo add-apt-repository -y ppa:tualatrix/ppa #ubuntu tweak | |
sudo add-apt-repository ppa:hertzog/nautilus-dropbox #nautilus-dropbox | |
sudo apt-get update | |
# upgrade dist | |
sudo apt-get upgrade |