Skip to content

Instantly share code, notes, and snippets.

View joeyism's full-sized avatar

Joey joeyism

View GitHub Profile
from allennlp.models.archival import load_archive
from allennlp.predictors.predictor import Predictor
SERIALIZATION_DIR = './model'
archive = load_archive(SERIALIZATION_DIR)
archive.model.share_memory() # <- puts the model into shared memory
predictor = Predictor.from_archive(archive, 'model')
from allennlp.models.archival import load_archive
from allennlp.predictors.predictor import Predictor
SERIALIZATION_DIR = './model'
archive = load_archive(SERIALIZATION_DIR)
predictor = Predictor.from_archive(archive, 'model')
FROM python:3.6
# Update Ubuntu instance
RUN apt-get update
# Make `/app` directory, copy all local files into that, and set it as working directory
RUN mkdir -p /app
COPY . /app
WORKDIR /app
from flask import Flask
app = Flask(__name__)
@app.route('/hello')
def helloIndex():
return 'Hello World from Python Flask!'
app.run(host='0.0.0.0', port=8080)
FROM ubuntu:18.04
# Update Ubuntu instance
RUN apt-get update
# Sets the environment variable ENV to `development`
ENV ENV=development
# echos $ENV
RUN echo $ENV
FROM ubuntu:18.04
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
from skimage import data
module = hub.Module("https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2")
height, width = hub.get_expected_image_size(module)
cat = data.chelsea()
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
from skimage import data
module = hub.Module("https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2")
height, width = hub.get_expected_image_size(module)
cat = data.chelsea()
import tensorflow as tf
import tensorflow_hub as hub
import urllib
import numpy as np
from skimage import data, transform
module = hub.Module("https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2")
height, width = hub.get_expected_image_size(module)