Skip to content

Instantly share code, notes, and snippets.

View nmwalsh's full-sized avatar
💻

Nick Walsh nmwalsh

💻
View GitHub Profile
@nmwalsh
nmwalsh / falcon_gateway.py
Created December 7, 2017 02:23
Falcon API gateway for a simple machine learning API
# falcon_gateway.py
import falcon
import json
from data_handler import invoke_predict
# Falcon follows the REST architectural style, meaning (among
# other things) that you think in terms of resources and state
# transitions, which map to HTTP verbs.
@nmwalsh
nmwalsh / predict.py
Created December 6, 2017 23:00
Standalone predict function for a saved Python ML model pickled in `model.dat`
# predict.py
# Script that should consist of a single method (predict) - passing data in a presumed parsimonious syntax to your model for prediction
#
# In this exaple, predict would require data of the following datatype:
# Pandas DataFrame with features
# X_test= [[ 6.9, 3.2, 5.7, 2.3]]
import os
import pickle
import pandas as pd
import random
@nmwalsh
nmwalsh / template.html
Created July 20, 2017 09:37
Facebook Instant Article Template
<!doctype html>
<html lang="en" prefix="op: http://media.facebook.com/op#">
<head>
<meta charset="utf-8">
<!-- URL of the web version of this article -->
<!-- TODO: Change the domain to match the domain of your website -->
<link rel="canonical" href="http://example.com/article.html">
<meta property="op:markup_version" content="v1.0">
</head>
<body>