Posts tagged with "Python"

Automated Batch Image Compression with Python

A Python script that automatically compresses PNG images by gradually reducing quality and color depth until a target file size is reached, using PIL (Python Imaging Library).

Published: July 30, 2024 | Last Modified: June 18, 2025

Visualizing and Analyzing Windows Folder Permissions

A comprehensive guide to exporting and visualizing Windows folder permissions using PowerShell and Python, including treemap visualizations of user access rights.

Published: June 1, 2024 | Last Modified: May 13, 2025

Window Monitoring with Machine Vision

A guide to setting up a window monitoring system using the Moondream2 machine vision model for real-time window content analysis.

Published: March 25, 2024 | Last Modified: May 13, 2025

Local AI API: Image-to-Text, Text-to-Speech, and LLM APIs

A practical collection of Python Flask API implementations for running various AI models locally, including image-to-text using Moondream, text-to-speech with Coqui TTS, and text generation via local LLMs with OpenAI-compatible interfaces.

Published: February 5, 2024 | Last Modified: May 13, 2025

Graphing a LAN with PyVis

A guide to visualizing Local Area Network (LAN) topologies using Python and pyvis for interactive network graphs.

Published: December 28, 2023 | Last Modified: May 13, 2025


Generating Knowledge Graphs with LLMs and PyVis

An experimental approach to extracting structured knowledge graphs from literary text using Mistral-7B LLM, demonstrated with the opening passage of The Hobbit and visualized as connected node-edge relationships.

Published: December 14, 2023 | Last Modified: May 13, 2025


Python NetworkX Library for Network Graph Visualization

A comprehensive guide to creating visually appealing network graphs with Python’s networkx library, including node positioning, custom coloring, edge labeling, and group visualization with ellipses.

Published: August 15, 2023 | Last Modified: May 13, 2025

QR Code Generator with Python

A Python script using the qrcode library to generate customizable QR codes with error correction, including options for masking specific areas of the code.

Published: June 24, 2023 | Last Modified: May 13, 2025

Deforum Cheat Sheet

This is a cheat sheet of animations showing what the various 3D translation and rotation settings do in Deforum Stable Diffusion.

Published: May 24, 2023 | Last Modified: May 13, 2025

3D Photo Inpainting with Python and PyTorch

A comprehensive guide to setting up and using 3D Photo Inpainting on Windows, including Miniconda environment setup, dependency installation, and usage instructions.

Published: May 12, 2023 | Last Modified: May 13, 2025

Deep Floyd IF

My tentative work flow for running Deep Floyd IF locally for image generation.

Published: May 3, 2023 | Last Modified: May 13, 2025

Thin Plate Spline Motion Model

A practical guide to using the Thin Plate Spline Motion Model for animating static images by transferring motion from a driving video, with setup instructions and observations about optimal video dimensions and motion tracking limitations.

Published: April 12, 2023 | Last Modified: May 13, 2025

OpenAI Whisper Speech Recognition Guide

Whisper is a general-purpose speech recognition model. It is trained on a large dataset of diverse audio and is also a multi-task model that can perform multilingual speech recognition as well as speech translation and language identification.

GitHub Repository

Installation

pip install git+https://github.com/openai/whisper.git 

Fix CUDA not detecting GPU

Whisper will default to the CPU if a GPU is not detected, which is considerably slower.
pip uninstall torch
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

Example usage

# Transcribe
whisper input.mp3 --model medium.en --language en --task transcribe
# Translate
whisper japanese.wav --model large --language Japanese --task translate

Available models and languages

There are five model sizes, four with English-only versions, offering speed and accuracy tradeoffs. Below are the names of the available models and their approximate memory requirements and relative speed.

Published: February 24, 2023 | Last Modified: May 13, 2025

Phishing Email Decoding Tools

atob() obfuscation

This p5.js script is designed to find and decode base64-encoded strings that are nested within one another. The script has several functions that work together to achieve this goal:

isBase64(str): This function checks if a given string str is a valid base64-encoded string. It uses a regular expression to test the string and the atob() function to try decoding the string. If the decoding is successful, the function returns true; otherwise, it returns false.

Published: February 15, 2023 | Last Modified: May 13, 2025

MiDaS Depth Estimation Guide

GitHub Repository

During installation, I ran into an issue where the CUDA package wasn’t found. Had to modify environment.yaml to:

name: midas-py310
channels:
  - pytorch
  - defaults
dependencies:
  - nvidia::cuda-toolkit=11.7.0
  - python=3.10.8
  - pytorch::pytorch=1.13.0
  - torchvision=0.14.0
  - pip=22.3.1
  - numpy=1.23.4
  - pip:
    - opencv-python==4.6.0.66
    - imutils==0.5.4
    - timm==0.6.12
    - einops==0.6.0

Commands that were helpful for troubleshooting CUDA:

Published: February 6, 2023 | Last Modified: May 13, 2025

Frame Interpolation Large Motion (FILM)

A comprehensive guide to setting up and using Google’s Frame Interpolation Large Motion (FILM) TensorFlow implementation, enabling the creation of smooth animations by generating intermediate frames between existing images using deep learning techniques.

Published: February 5, 2023 | Last Modified: May 13, 2025

Stable Diffusion Scripts

A comprehensive collection of utility scripts for automating image processing tasks with Stable Diffusion outputs, including batch file renaming, color grading, pixel art conversion, and video processing tools.

Published: February 5, 2023 | Last Modified: May 13, 2025