semvec/pypi-packages huggingface dataset:
face-embeddings-lib 0.1.0
A minimal library for extracting face embeddings using YOLO for detection and Facenet for embedding.
License: MIT
Requires Python: >=3.10

# face-embeddings-lib

A minimal library for extracting face embeddings from images using YOLO (for face detection) and Facenet (for embedding extraction). Useful for any application needing facial embeddings or face search.

## Installation

Install dependencies with Poetry:

```bash
poetry install
```

Or directly with pip:

```bash
pip install ultralytics facenet-pytorch torch opencv-python numpy
```

## Usage Example

```python
from face_embeddings_lib import EmbeddingEngine

with open("image.jpg", "rb") as f:
    image_bytes = f.read()

engine = EmbeddingEngine()
embeddings = engine.generate_face_embeddings(image_bytes)

print("Number of faces:", embeddings.get("face_count"))
print("Embeddings:", embeddings.get("face_embedding"))
```

- `face_embedding` will be a list of 512-float vectors averaged across faces found.
- `face_count` is the number of faces detected.
- `annotated_bytes` is the JPEG-encoded annotated image (you can save it or display it).

## Requirements

- Python 3.10 or 3.11
- Torch with CUDA enabled for best performance (optional)

## License

MIT

# face-embeddings-lib

repo for embeddings functions package
template-string-logger 1.0
Python logger that supports t-strings
License: MIT
Requires Python: >=3.14

# tstring-logger
Python logging with template strings with support for conditional (lazy) execution of functions in log messages. 

Provides **TStringLogger(logging.Logger)** and sets it as the default logger class upon `import tstring_logger`

A **Template String** may embed function calls with a *!fn* format specifier. They will only be executed if the logger is active.

## Example ##
```
import logging
import tstring_logger

def expensive_function(x):
    time.sleep(1)
    return 2 * x

logging.basicConfig()
lg = logging.getLogger("demo")
hour = datetime.datetime.now().hour
print(1)
lg.debug(test := t"The thing happened with {expensive_function:!fn} {7} at hour {hour}.")
print(2)
lg.setLevel(logging.DEBUG)
lg.debug(test)
print(3)
```

will quickly print 1 and 2, then pause a second before 3 appears after *DEBUG:demo:The thing happened with 14 at hour 16.*
Since *expensive_function* takes a single argument, the 7 is passed to the function while *hour* renders in the usual way.

The logger uses the *embed* function of [tstring-util](https://pypi.org/project/tstring-util/).