summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorDominic DiTaranto <domdit@gmail.com>2024-09-22 21:30:28 -0400
committerDominic DiTaranto <domdit@gmail.com>2024-09-22 21:30:28 -0400
commit75e802e5b27425db95d000f714e3b3363a5e1a9c (patch)
tree1ed046b10702a9340934adeb6859f5322ef4920b /app.py
inital commitHEADmaster
Diffstat (limited to 'app.py')
-rw-r--r--app.py27
1 files changed, 27 insertions, 0 deletions
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)