ls /usr/bin/python*
sudo apt-get remove python3.5
sudo apt-get remove --auto-remove python3.5
sudo apt-get purge python3.5
import numpy as np | |
import matplotlib.pyplot as plt | |
def get_bboxes_from(output): | |
""" returns list of bboxes """ | |
return outputs["instances"].__dict__['_fields']['pred_boxes'].__dict__['tensor'] | |
def crop(bbox, in_img: np.ndarray): | |
""" bbox is a list with xmin, ymin, xmax, ymax """ |
import multiprocessing #:) | |
def do_this(number): | |
print number | |
return number*2 | |
# Create a list to iterate over. | |
# (Note: Multiprocessing only accepts one item at a time) | |
some_list = range(0,10) |
""" | |
Usage: | |
Make sure that redis is running on localhost (or adjust the url) | |
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html | |
pip install -u uvicorn | |
Install dependencies |
# empty |
1WBllCh7h5NjY09cvDby-amOO2FN0HbOA |
# source: https://www.geeksforgeeks.org/difference-between-multithreading-vs-multiprocessing-in-python/ | |
import time, os | |
from threading import Thread, current_thread | |
from multiprocessing import Process, current_process | |
COUNT = 200000000 | |
SLEEP = 10 | |
def io_bound(sec): |
def f(*, a): | |
pass | |
f(1) # raises error | |
f(a=1) # works |
# ======================================================================================== | |
# setup image | |
# ======================================================================================== | |
# download or build image | |
docker build . | |
# ======================================================================================== | |
# setup container | |
# ======================================================================================== |