semvec/pypi-packages huggingface dataset:
mslarkin-utils 1.68
Frequently used utilities for Python
Requires Python: >=3.8
Keywords: mslarkin

Background load:  
* LOADGEN_START_DELAY - delay for initial start (default = 0)
* LOADGEN_WORK_BREAK - sets frequency of loadgen
    - DEFAULT -> 600
    - 600 -> 10min break between cycles (intermittent) 
    - 15 -> 15s break (near-constant)
* LOADGEN_CPU_INTENSITY - sets intensity of loadgen CPU usage
    - DEFAULT -> 1 (low)
    - .01 -> high CPU load
    - .35 -> moderate CPU load
    - 1.25 -> low CPU load
* LOADGEN_MAX_PRIMES - set how long the load calculation takes (important for request-based loads) 
    - DEFAULT -> 25 
    - 1 -> usually quick (seconds)
    - 25 -> ~4-5min
* LOADGEN_RANDOMIZE_WORK_BREAK - randomizes the frequency (work_break)
    - When True, work_break ranges from 15 to LOADGEN_WORK_BREAK
* LOADGEN_MEMORY_MB - memory consumption
    - DEFAULT -> 1

Request load:  
* REQUEST_CPU_INTENSITY
    - DEFAULT -> 0 (random)
    - Setting to 0 uses random range from 0.01-1.0
* REQUEST_MEMORY_MB 
    - DEFAULT -> .1
* REQUEST_MAX_PRIMES
    - DEFAULT -> 1
SimpleAI-Image 0.1.8
A package for processing and storing image vectors in PostgreSQL
Requires Python: >=3.10

# SimpleAI_Image

A package for processing and storing image vectors in PostgreSQL.

## Installation

```bash
pip install SimpleAI_Image

from SimpleAI_Image import DatabaseHandler, DataProcessor
from sklearn.datasets import fetch_openml
from tensorflow.keras.applications.vgg16 import preprocess_input as vgg_preprocess_input

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sqlalchemy import text

# Define the database URL and table name
db_url = 'postgresql+psycopg2://Username:Password@localhost:5432/ThisISATEST'
db_handler = DatabaseHandler(db_url, 'vector_data', 512)

# Instantiate DataProcessor with VGG16 model
data_processor = DataProcessor(db_handler, model_name='VGG16', preprocess_func=vgg_preprocess_input, image_size=(32, 32))

# Load the example dataset (MNIST)
mnist = fetch_openml('mnist_784', version=1)
X = mnist.data[:500]  # Limit to 500 instances for testing
y = mnist.target[:500].astype(int)  # Ensure targets are integers

# Process data and store in database
X_embedded, y = data_processor.process_data(X, y)

# Fetch and preprocess data for visualization
query = text("SELECT * FROM vector_data")
X_embedded, y = data_processor.fetch_and_preprocess_data(query)

# Visualize data
data_processor.visualize_data(X_embedded, y)