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
# 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
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
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
# 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
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") |
OlderNewer