Created
September 26, 2020 14:53
-
-
Save Createdd/588bcc886f0d3c57b79410e60f7b0fe2 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
@app.route('/predict',methods=['POST']) | |
def predict(): | |
input_val = [x for x in request.form.values()][0] | |
rf = load_model(BUCKET_NAME, MODEL_FILE_NAME, MODEL_LOCAL_PATH) | |
if input_val not in available_countries: | |
return f'Country {input_val} is not in available list. Try one from the list! Go back in your browser', 400 | |
to_pred = get_prediction_params(input_val, url_to_covid) | |
prediction = rf.predict(to_pred)[0] | |
return render_template('home.html',pred=f'New cases will be {prediction}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment