semvec/pypi-packages huggingface dataset:
djecorator 1.2.0
A flask-style decorator for Django views

# Djecorator

Write Django routes in the same style as Flask.

## Installation

```
pip install djecorator
```

## Usage

### views.py

```python
from django.shortcuts import render
from djecorator import Route

route = Route()

@route("/")
def index(request):
    return render(request, "index.html")

# With path and name parameters
@route("/about/", name="about_page")
def about(request):
    return render(request, "about.html")

# With login required protection
@route("/dashboard/", login_required=True)
def dashboard(request):
    # Only accessible to authenticated users
    return render(request, "dashboard.html")
```

### urls.py

```python
import views

urlpatterns = [
    ...
]

urlpatterns += views.route.patterns
```

## Features

- **Flask-like routing**: Define your routes directly above your view functions
- **Prefixing**: Add URL and name prefixes to group related routes
- **Authentication**: Protect routes with Django's `login_required` decorator
- **Class-based views**: Works with both function-based and class-based views

### Route Parameters

The `Route` class accepts the following parameters:

- `url_prefix`: Prefix added to all URL paths
- `name_prefix`: Prefix added to all URL names

The `@route()` decorator accepts the following parameters:

- `path`: The URL path (defaults to the function name)
- `name`: The URL name (defaults to the function name)
- `login_required`: Whether the view requires authentication (defaults to False)

### Example with prefixes

```python
# Create a route with prefixes
admin_route = Route(url_prefix="/admin", name_prefix="admin_")

@admin_route("/users/")
def admin_users(request):
    # This will be available at /admin/users/
    # and have the URL name "admin_users"
    return render(request, "admin/users.html")

@admin_route("/settings/", login_required=True)
def admin_settings(request):
    # This will be available at /admin/settings/
    # and have the URL name "admin_settings"
    # and require login
    return render(request, "admin/settings.html")
```
deeplocalizer 0.0.3
Package to localize torch deep learning models
Requires Python: >=3.10

# DeepLocalizer

[![PyPI - Version](https://img.shields.io/pypi/v/deeplocalizer.svg)](https://pypi.org/project/deeplocalizer) 

[Blog Post](https://www.donnybertucci.com/project/deeplocalizer#blog), [Docs](https://xnought.github.io/deeplocalizer)


**Quickly find functional specialization in PyTorch models.**

Extends [The LLM Language Network: A Neuroscientific Approach for Identifying Causally Task-Relevant Units](https://arxiv.org/abs/2411.02280) to other models and data.


Examples:

- [Face Localizer Resnet Report](https://www.donnybertucci.com/project/deeplocalizer)
- [Face Localizer Resnet Notebook](./resnet34_example.ipynb)
- [Face Localizer Data Viewer](./face_data_viewer.ipynb)

## Task Usage

Tasks are just pandas dataframes with a `data`, `positive`, and `validation` columns. Each row is a different data point.

See [`face_data_viewer.ipynb`](./face_data_viewer.ipynb) to see a real example of a face localizer data (face images from CelebA vs. objects images from COCO).


**What do the columns mean?**

- `data` is the data itself (eg text) or points to data (eg image filename)
- `positive` is `True` for the task and `False` for the control (eg face images have `True` and control images have `False`)
- `validation` is technically optional. If you want to notate some rows to only be used later on to test performance and not for the main localization, you can indicate a subset of the rows as `True`. The main dataset used for localization is then `False`.

Again see [`face_data_viewer.ipynb`](./face_data_viewer.ipynb) if you're still confused.

## Library Usage

**Install**

```bash
uv add deeplocalizer
```

or

```bash
pip install deeplocalizer
```

**API Usage**

See exact functions at [Docs](https://xnought.github.io/deeplocalizer) and see [`resnet34_example.ipynb`](./resnet34_example.ipynb) for an example of using those functions.


## Development

```bash
cd deeplocalizer # this git repo
```

Make sure to have https://docs.astral.sh/uv/ installed.

**Install and Run**

```bash
uv sync
uv run deeplocalizer/deeplocalizer.py
```

or run an example python notebook within the .env generated.

**Run Docs**

```bash
uv run mkdocs serve
```

## References

**papers**
- https://arxiv.org/abs/2411.02280
- https://web.mit.edu/bcs/nklab/media/pdfs/Dobs_2022.pdf

**code/datasets**
- https://huggingface.co/datasets/tpremoli/CelebA-attrs
- https://huggingface.co/datasets/phiyodr/coco2017
- https://huggingface.co/microsoft/resnet-50