Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
Howdy y'all

Zhanwen Chen zhanwenchen

🤠
Howdy y'all
  • Athens, GA
View GitHub Profile
@zhanwenchen
zhanwenchen / translate_web_app.py
Created Jan 9, 2019
A Flask web app that uses the Server class defined in translate_client.py
View translate_web_app.py
# -*- coding: utf-8 -*-
import os
import sys
import logging
from flask import Flask, request, jsonify
from flask_cors import CORS, cross_origin
from translate_client import Server
@zhanwenchen
zhanwenchen / translate_client.py
Last active Jan 9, 2019
A low-level API to connect with a running gRPC server and pass to it a TensorFlow-Serving prediction request
View translate_client.py
"""
Adapted from https://github.com/Vetal1977/tf_serving_example/blob/master/svnh_semi_supervised_client.py
"""
# -*- coding: utf-8 -*-
import time
from argparse import ArgumentParser
import numpy as np
@zhanwenchen
zhanwenchen / export_tf_model.py
Last active Aug 31, 2021
Minimal code to load a trained TensorFlow model from a checkpoint and export it with SavedModelBuilder
View export_tf_model.py
import os
import tensorflow as tf
trained_checkpoint_prefix = 'checkpoints/dev'
export_dir = os.path.join('models', '0') # IMPORTANT: each model folder must be named '0', '1', ... Otherwise it will fail!
loaded_graph = tf.Graph()
with tf.Session(graph=loaded_graph) as sess:
# Restore from checkpoint
loader = tf.train.import_meta_graph(trained_checkpoint_prefix + '.meta')
@zhanwenchen
zhanwenchen / sequelize-schema-file-generator.js
Created Oct 19, 2017 — forked from ahelord/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
View sequelize-schema-file-generator.js
'use strict';
//////////////////////////////////
// How to use?
// 1. Create `sequelize-schema-file-generator.js` in your app root
// 2. Make sure you've ran the `sequelize init` before (It should create `config`,`seeders`,`migrations` folders).
// 3. Update `DATABASE_DSN` below to match your connection string (works with any database adapter that Sequelize supports)
// 4. Run it with `node sequelize-schema-file-generator.js`
// 5. Review the generated migrations inside of the `migrations` folder.
//////////////////////////////////
@zhanwenchen
zhanwenchen / Install NVIDIA Driver and CUDA.md
Last active Apr 12, 2021 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 9.0 on Ubuntu 16.04.4 LTS
View Install NVIDIA Driver and CUDA.md