-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
54 lines (41 loc) · 1.2 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from utils import FirebaseApi, camera
from dotenv import dotenv_values
import time
from flask import Flask, render_template
import pandas as pd
import json
import plotly
import plotly.express as px
config = dotenv_values(".env")
api = FirebaseApi(config['creds_file'],
config['db_url'])
cupsin, cupsout = api.visualize()
print(cupsin)
print(cupsout)
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/chart')
def chart1():
cupsin, cupsout = api.visualize()
df = pd.DataFrame({
"Cups": ["Cupin", "Cupsout"],
"Amount": [cupsin, cupsout],
})
fig = px.bar(df, x="Cups", y="Amount", barmode="group")
graphJSON = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
header="Cups Status"
description = """
Cup Status and measurements inside UWCSEA dover
"""
return render_template('chart.html', graphJSON=graphJSON, header=header,description=description)
@app.route('/leaderboard')
def leaderboard():
return render_template('leaderboard.html')
@app.route('/style.css')
def style():
return render_template('style.css')
@app.route('/script.js')
def script():
return render_template('script.js')