Created
October 9, 2020 09:00
-
-
Save StevenReitsma/ee23b22900936f1feb853aa8b7017e93 to your computer and use it in GitHub Desktop.
Vantage training
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 joblib | |
from flask import Flask, request | |
import numpy as np | |
import os | |
app = Flask(__name__) | |
model = None | |
def load_model(path): | |
return joblib.load(path) | |
@app.route("/api/v1/predict", methods=["POST"]) | |
def predict(): | |
json = request.json | |
input_image = np.array([json['image']]) | |
return {"result": int(model.predict(input_image)[0])} | |
if __name__ == "__main__": | |
model = load_model(os.path.join(os.environ["MODEL_PATH"], "saved_model.pkl")) | |
app.run(debug=True, host='0.0.0.0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment