From 75e802e5b27425db95d000f714e3b3363a5e1a9c Mon Sep 17 00:00:00 2001 From: Dominic DiTaranto Date: Sun, 22 Sep 2024 21:30:28 -0400 Subject: inital commit --- app.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app.py (limited to 'app.py') diff --git a/app.py b/app.py new file mode 100644 index 0000000..32c1237 --- /dev/null +++ b/app.py @@ -0,0 +1,27 @@ +import ast +from flask import Flask, render_template, request +from constants import chords +from generate_chord_tones import ChordToneGenerator + + +app = Flask(__name__) + + +@app.route('/', methods=('GET', 'POST')) +def index(): + chord_map = None + counts = None + if request.method == 'POST': + selected_chords = [] + for chord in request.form: + current_chord = request.form.get(chord) + if current_chord: + selected_chords.append(current_chord) + + if selected_chords: + generator = ChordToneGenerator(selected_chords) + generator.main() + chord_map = generator.prepped_chord_map + counts = generator.counts + + return render_template('index.html', chords=chords, chord_map=chord_map, counts=counts) -- cgit v1.2.3-70-g09d2