This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User(BaseModel, db.Model): | |
__tablename__ = 'user' | |
id = db.Column(db.Integer, primary_key=True) | |
email = db.Column(db.String(120), unique=True, nullable=False) | |
email_confirmed = db.Column(db.Boolean, default=False) | |
email_confirmed_on = db.Column(db.DateTime(timezone=True)) | |
waitlist = db.relationship('Waitlist', uselist=False, back_populates='user') | |
def __init__(self, email): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_app(): | |
server = Flask(__name__) | |
server.config.from_object(BaseConfig) | |
from app.dashapp1.layout import layout as layout1 | |
from app.dashapp1.callbacks import register_callbacks as register_callbacks1 | |
register_dashapp(server, 'Dashapp 1', 'dashboard', layout1, register_callbacks1) | |
from app.dashapp2.layout import layout as layout2 | |
from app.dashapp2.callbacks import register_callbacks as register_callbacks2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime as dt | |
import pandas_datareader as pdr | |
from dash.dependencies import Input | |
from dash.dependencies import Output | |
def register_callbacks(dashapp): | |
@dashapp.callback(Output('my-graph', 'figure'), [Input('my-dropdown', 'value')]) | |
def update_graph(selected_dropdown_value): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Other dash and not related imports | |
# ... | |
# Import factory method | |
from app import create_app | |
# Method to protect dash views/routes | |
def protect_dashviews(dashapp): | |
for view_func in dashapp.server.view_functions: | |
if view_func.startswith(dashapp.url_base_pathname): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from config import BaseConfig | |
def create_app(): | |
server = Flask(__name__) | |
server.config.from_object(BaseConfig) | |
register_extensions(server) | |
register_blueprints(server) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imports here | |
# .... | |
server_bp = Blueprint('main', __name__) | |
@server_bp.route('/') | |
def index(): | |
return render_template("index.html", title='Home Page') | |
@server_bp.route('/login', methods=['GET', 'POST']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib notebook | |
import pandas_datareader as pdr | |
from sklearn.linear_model import LinearRegression | |
from sklearn.metrics import mean_squared_error | |
# Download gold data (ETF) | |
gld = pdr.get_data_yahoo('GLD',start='1984-01-01') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# memory footprint support libraries/code | |
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi | |
!pip install gputil | |
!pip install psutil | |
!pip install humanize | |
import psutil | |
import humanize | |
import os | |
import GPUtil as GPU |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% This file was created by matlab2tikz. | |
% | |
\documentclass[tikz]{standalone} | |
\usepackage{pgfplots} | |
\usepackage{grffile} | |
\pgfplotsset{compat=newest} | |
\usetikzlibrary{plotmarks} | |
\usepgfplotslibrary{patchplots} | |
\usepackage{amsmath} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% This file was created by matlab2tikz. | |
% | |
\documentclass[tikz]{standalone} | |
\usepackage{pgfplots} | |
\usepackage{grffile} | |
\pgfplotsset{compat=newest} | |
\usetikzlibrary{plotmarks} | |
\usepgfplotslibrary{patchplots} | |
\usepackage{amsmath} |