def retail(): if request.method=="POST": print(request.form) if request.form: try: steps=int(request.form.to_dict(flat=False)['steps'][0]) print(steps) if steps<=12: prediction1 = predict(steps) prediction2 = predict2(steps) prediction3 = predict3(steps) prediction4 = predict4(steps) return render_template('retail.html',steps = steps, prediction1=prediction1, prediction2=prediction2, prediction3=prediction3, prediction4=prediction4) else: steps = 12 prediction1 = predict(steps) prediction2 = predict2(steps) prediction3 = predict3(steps) prediction4 = predict4(steps) return render_template('retail.html',steps = steps, prediction1=prediction1, prediction2=prediction2, prediction3=prediction3, prediction4=prediction4) except: prediction1 = None prediction2 = None prediction3 = None prediction4 = None return render_template('retail.html', prediction1=prediction1, prediction2=prediction2, prediction3=prediction3, prediction4=prediction4) else: prediction1 = None prediction2 = None prediction3 = None prediction4 = None return render_template('retail.html', prediction1=prediction1, prediction2=prediction2, prediction3=prediction3, prediction4=prediction4) else: prediction1 = None prediction2 = None prediction3 = None prediction4 = None return render_template('retail.html', prediction1=prediction1, prediction2=prediction2, prediction3=prediction3, prediction4=prediction4)
def predict_flower_new(): ''' returns a flower prediction ''' if request.method == 'POST': if 'file' not in request.files: return Response('No file uploaded', status=500) else: return jsonify({"name": predict3(request.files['file'])}) else: return Response('Bad request', status=500)