How to use matplotlib without X-Window-Server
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(1, 1, 1) ax1.plot(range(20)) ax1.grid() fig.savefig('aaa.png')
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(1, 1, 1) ax1.plot(range(20)) ax1.grid() fig.savefig('aaa.png')
About If you don’t have SSL certificate, downloading files sometimes get failed. And the error like ssl.SSLError happens. Here shows…
ffmpeg -i input.mp3 -ss 00:00:00 -t 00:04:00 -acodec copy output.mp3
@app.websocket("/ws") async def websocket_endpoint(ws: WebSocket): await ws.accept() key = ws.headers.get('sec-websocket-key')
Saving memory Specifying slots causes the instance’s attribute values to be stored in the form of an array of slots…
1. by using bind=True For using function over Celery, it is required to use a function ‘Decorator’ in Python primitive.…
RabbitMQ can use multiple ports. This is done to support multiple protocols. For example, RabbitMQ uses port 5672 to communicate…
convert skimage to PIL image to bytes, post it Another example
class_name = None if pattern == 'test-a': class_name = 'TestA' elif pattern == 'test-b': class_name = 'TestB' if class_name is…
import huggingface_hub download_path = huggingface_hub.snapshot_download( repo_id=model_name, local_dir=dir_path ) model = BertModel.from_pretrained(model_name, cache_dir=dir_path)