Skip to content

Instantly share code, notes, and snippets.

@i-amgeek
Last active December 25, 2019 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i-amgeek/cf181dcf9f8a5611f72c2c73c65c5795 to your computer and use it in GitHub Desktop.
Save i-amgeek/cf181dcf9f8a5611f72c2c73c65c5795 to your computer and use it in GitHub Desktop.
from flask import Flask, request
from run import Model
import json
app = Flask(__name__,
static_url_path='',
static_folder='')
model = Model()
@app.route('/')
def index():
with open("info.json", "r") as f: data = eval(f.read())
return f"Welcome to dockship. \n\n ModelName: {data['modelname']}\
\n Short Description: {data['modelShortDescription']}\
\n\n For any queries/problems, contact us at contact@dockship.io\
"
@app.route('/predict', methods=['GET'])
def predict():
input = request.args['input']
return json.dumps(model.run(json.loads(input)))
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0',port = '56733')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment