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
# Helper functions | |
def get_proc_name(proc): | |
try: | |
if "jupyter lab --allow-root" in proc.cmdline(): | |
return "coding_bench" | |
return os.path.basename([line for line in proc.cmdline() if ".py" in line][0]).split(".py")[0] | |
except IndexError: | |
return "" | |
except psutil.NoSuchProcess: |
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
import imghdr | |
import sys | |
from io import BytesIO | |
import yaml | |
from flask import Flask, send_file | |
from flask_restful import reqparse, Api, Resource | |
import werkzeug | |
import os | |
from utils import last_changed_file | |
from zipfile import ZipFile |
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
# Helper functions | |
def now_string(seconds=False, microsec=False, only_date=False, log_timestamp=False): | |
now = datetime.datetime.now() | |
if log_timestamp: | |
return str(now.day) + "-" + str(now.month) + "-" + str(now.year) + ' ' + str(now.hour) + ":" + str( | |
now.minute) + ":" + str(now.second) + "." + str(now.microsecond)[:2] + " ~~ " | |
if only_date: | |
return str(now.day) + "_" + str(now.month) + "_" + str(now.year) | |
now_str = str(now.day) + "_" + str(now.month) + "_" + str(now.year) + '_' + str(now.hour) + "_" + str(now.minute) |
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
# Helper functions | |
def last_changed_file(dir_path=None, ends_with="", report_error=True): | |
try: | |
if dir_path is None: | |
dir_path = os.getcwd() | |
list_of_files = glob.glob(dir_path + '/*') | |
if len(ends_with) > 0: | |
list_of_files = [file for file in list_of_files if file.endswith(ends_with)] | |
try: |
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
# Helper functions | |
def models_table(files_in_dir=None, models_dir=configs['MODELS_DIR'], use_models_dir=True): | |
if use_models_dir is False: | |
models_dir = os.getcwd() | |
if files_in_dir is None: | |
files_in_dir = os.listdir(models_dir) | |
if ".gitignore" in files_in_dir: | |
files_in_dir.remove(".gitignore") | |
file_modified_time = [ |
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
# Helper fucntions | |
def is_authenticated(user, password): | |
if (user == 'Admin' and password == "12345678"): | |
return True | |
else: | |
return False | |
def linespace_generator(n_spaces=1): | |
for i in range(n_spaces): | |
st.write("") |
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
# Helper functions | |
def data_preprocess(state, process_table_sidebar): | |
autosave_session(state) | |
st.title("Data Preprocess") | |
... | |
def training(state, process_table_sidebar): | |
autosave_session(state) | |
st.title("Train Model") | |
... | |
... # evaluation, prediction, save_and_load, free_coding, deployment |
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
# Helper functions | |
def get_jupyter_configs(file_name=None): | |
if file_name == None: | |
file_name = os.path.expanduser(os.path.join(("~"), ".jupyter", "jupyter_notebook_config.py")) | |
with open(file_name) as f: | |
lines = f.readlines() | |
relevant_lines = [line.replace("\n", "") for line in lines if | |
not line.lstrip().startswith("#") and not line == '\n'] |
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
### app.py file ### | |
# Packages needed for all 10 features in the article | |
import yaml | |
import streamlit as st | |
import contextlib | |
import os | |
import subprocess | |
import sys |
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
{ | |
"instances": [ | |
{ | |
"start": "2011-11-01 00:00:00", | |
"target": [5.0, 9.0, "NaN", 100.0, 113.0], | |
"cat": [0, 1], | |
"dynamic_feat": [[1.0, 1.1, 2.1, 0.5, 3.1, 4.1, 1.2, 5.0]] | |
}, | |
{ | |
"start": "2022-01-30", |
OlderNewer