diff --git a/__pycache__/app.cpython-37.pyc b/__pycache__/app.cpython-37.pyc index 4843a52..e781f97 100644 Binary files a/__pycache__/app.cpython-37.pyc and b/__pycache__/app.cpython-37.pyc differ diff --git a/app.py b/app.py index 345e29a..375e915 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ from flask import Flask, render_template, request, redirect, Response from sympy import * -from helpers import apology +from helpers import apology, setup_symbols, gif_apology import numpy as np import matplotlib matplotlib.use('Agg') @@ -251,18 +251,6 @@ def errorhandler(e): e = InternalServerError() return apology(e.name, e.code) -def setup_symbols(f): - f = sympify(f) - - # replace commonly used variables with x - for letter in [x, y, z, t, X, Y, Z, T]: - f = f.subs(letter, x) - return f - -def gif_apology(message="oopsy", code=400): - "Render gif failure" - PATH = 'static/img/gifs/reaction' + str(2) + '.gif' - return render_template("gif_apology.html", PATH=PATH) if __name__ == '__main__': diff --git a/helpers.py b/helpers.py index 845a7f4..de2942c 100644 --- a/helpers.py +++ b/helpers.py @@ -1,7 +1,10 @@ import requests - from flask import redirect, render_template, request, session from functools import wraps +from sympy import * +import random + +x, y, z, t, X, Y, Z, T = symbols('x y z t X Y Z T') def apology(message, code=400): @@ -36,3 +39,16 @@ def login_required(f): def usd(value): """Format value as USD.""" return f"${value:,.2f}" + +def setup_symbols(f): + f = sympify(f) + + # replace commonly used variables with x + for letter in [x, y, z, t, X, Y, Z, T]: + f = f.subs(letter, x) + return f + +def gif_apology(message="oopsy", code=400): + "Render gif failure" + PATH = 'static/img/gifs/reaction' + str(random.randint(1,5)) + '.gif' + return render_template("gif_apology.html", PATH=PATH) diff --git a/static/img/maxmin_plot.png b/static/img/maxmin_plot.png index 167ee02..229443a 100644 Binary files a/static/img/maxmin_plot.png and b/static/img/maxmin_plot.png differ