forked from Tmalasky/Beer_Recommender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
29 lines (23 loc) · 1000 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, render_template, request, redirect, url_for
import beer_model_script
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def home():
return render_template("Beer_Recommender.html")
@app.route("/your-beers", methods=["GET", "POST"])
def your_beers():
if request.method == "POST":
user_input = request.form.getlist('user_input')
pred_style, top_5_same_style, top_5_diff_style = beer_model_script.find_beers(user_input)
return render_template(
"your-beers.html", pred_style = pred_style, top_5_same_style = top_5_same_style, top_5_diff_style = top_5_diff_style
)
else:
return render_template(
"your-beers.html", pred_style = pred_style, top_5_same_style = top_5_same_style, top_5_diff_style = top_5_diff_style
)
@app.route("/about", methods=["GET", "POST"])
def about():
return render_template("about.html")
if __name__ == "__main__":
app.run(debug=True)