-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
58 lines (48 loc) · 1.88 KB
/
index.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import beat_tracker
import chroma_amp
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, jsonify
from werkzeug import secure_filename
# Initialize the Flask application
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/demo')
def demo():
chroma_amps = chroma_amp.getXXChromaAmps()
beats = beat_tracker.getXXBeats()
print "READY TO RENDER"
return render_template('demo.html', data_ca=chroma_amps, data_b=beats, artist=1)
@app.route('/demoXX')
def demoXX():
chroma_amps = chroma_amp.getXXChromaAmps()
beats = beat_tracker.getXXBeats()
print "READY TO RENDER"
return render_template('demo.html', data_ca=chroma_amps, data_b=beats, artist=1)
@app.route('/demoDMX')
def demoDMX():
chroma_amps = chroma_amp.getDMXChromaAmps()
beats = beat_tracker.getDMXBeats()
print "READY TO RENDER"
return render_template('demo.html', data_ca=chroma_amps, data_b=beats, artist=2)
@app.route('/demoHAIM')
def demoHAIM():
chroma_amps = chroma_amp.getHAIMChromaAmps()
beats = beat_tracker.getHAIMBeats()
print "READY TO RENDER"
return render_template('demo.html', data_ca=chroma_amps, data_b=beats, artist=3)
@app.route('/MYANACONDADONT')
def demoANACONDA():
chroma_amps = chroma_amp.getAnacondaChromaAmps()
beats = beat_tracker.getAnacondaBeats()
print "READY TO RENDER"
return render_template('demo.html', data_ca=chroma_amps, data_b=beats, artist=4)
if __name__ == '__main__':
port = int(os.environ.get('PORT',5000))
app.run(host='0.0.0.0', port=port)