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 rich.console import Console, Group | |
from rich.live import Live | |
from rich.status import Status | |
import asyncio | |
import time | |
class MultiStatus: | |
def __init__(self, tasks): | |
self.statuses = { | |
name: Status(f"{name}: Starting...", spinner="dots", spinner_style="green") |
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
# Dockerfile | |
FROM quay.io/centos/centos:stream9 | |
# Enable better debugging | |
SHELL ["/bin/bash", "-x", "-c"] | |
# Install Python and required packages | |
RUN dnf update -y && \ | |
dnf install -y python3 python3-pip openssl openssl-devel gcc python3-devel \ | |
crypto-policies-scripts && \ |
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 time | |
import gc | |
import psutil | |
import humanize | |
gc.collect() | |
time.sleep(2) | |
mem_before = psutil.virtual_memory()[3] |
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 itertools | |
from scipy import signal | |
import pywt | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.decomposition import FastICA | |
# ############################################################################# |
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
# Download the TensorFlow Serving Docker image and repo | |
docker pull tensorflow/serving | |
# Start TensorFlow Serving container and open the REST API port | |
docker run -t --rm -p 8501:8501 -v "/home/vaclav/PycharmProjects/the-algorithm-lab/tensorflow2/practice/deployment/my_model:/models/my_model" -e MODEL_NAME=my_model tensorflow/serving & | |
# Query the model using the predict API | |
curl -d '{"instances": [17.99000,20.57000,19.69000,11.42000,20.29000,12.45000,18.25000,13.71000,13.00000,12.46000,16.02000,15.78000,19.17000,15.85000,13.73000,14.54000,14.68000,16.13000,19.81000,13.54000,13.08000,9.50400,15.34000,21.16000,16.65000,17.14000,14.58000,18.61000,15.30000,17.57000]}' \ | |
-X POST http://localhost:8501/v1/models/my_model:predict |
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 svg_write(fig, center=True): | |
""" | |
Renders a matplotlib figure object to SVG and embedd it as base64. | |
Disable center to left-margin align like other objects. | |
Shamelessly taken from: | |
https://discuss.streamlit.io/t/display-svg/172 | |
""" | |
# Save to stringIO instead of file | |
imgdata = StringIO() |
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 json | |
import pickle | |
class Foo: | |
""" An old Foo.""" | |
def __init__(self, a, b): | |
self.a = a | |
self.b = b |
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 python:3.8-alpine | |
# Define global args | |
ARG FUNCTION_DIR="/home/app/" | |
RUN apk add --no-cache \ | |
libstdc++ | |
# Install aws-lambda-cpp build dependencies | |
RUN apk add --no-cache \ |
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 scipy.integrate import simpson | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def almost_fourier_transform(g: np.ndarray, t: np.ndarray, f: float): | |
# approximate center of mass as a mean | |
t1 = np.min(t) | |
t2 = np.max(t) | |
scaling_factor = (1 / (t2 - t1)) |
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
51 | |
27 68 | |
30 48 | |
43 67 | |
58 48 | |
58 27 | |
37 69 | |
38 46 | |
46 10 | |
61 33 |
NewerOlder