Last active
December 25, 2019 12:11
-
-
Save i-amgeek/cf181dcf9f8a5611f72c2c73c65c5795 to your computer and use it in GitHub Desktop.
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
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 [email protected]\ | |
" | |
@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