# Default File Upload Limits in Pixelle-Video: Configuration and Implementation Guide

> Discover Pixelle-Video's default 100 MB file upload limit and learn how to configure it in api config py. This guide simplifies asset management.

- Repository: [AIDC-AI/Pixelle-Video](https://github.com/AIDC-AI/Pixelle-Video)
- Tags: how-to-guide
- Published: 2026-04-23

---

**Pixelle-Video enforces a default 100 MB file upload limit for all assets, defined centrally in the `APIConfig` class in [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py).**

The AIDC-AI Pixelle-Video repository implements a unified file size ceiling that governs uploads across its entire architecture—from FastAPI backend endpoints to Streamlit frontend components. Understanding this limit and how to work with it is essential for developers integrating with or extending the platform.

## Where the Upload Limit Is Defined

The authoritative source for Pixelle-Video's file upload restrictions resides in a single configuration file.

### The APIConfig Class in api/config.py

In [[`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py)](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) at line 39, the `APIConfig` Pydantic model declares:

```python
max_upload_size: int = 100 * 1024 * 1024  # 100 MB

```

This 100 MB default applies globally unless explicitly overridden through custom configuration instances. The comment makes the intent unambiguous, while the byte-level calculation (`100 * 1024 * 1024` = 104,857,600 bytes) ensures precise enforcement.

## How the Upload Limit Propagates Through the System

Pixelle-Video's architecture ensures consistent enforcement by threading this configuration through multiple layers.

### Backend Enforcement in FastAPI

The [`api/app.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/app.py) module initializes the FastAPI application with the `APIConfig` instance. Route handlers throughout the backend import this configuration and validate uploads against `max_upload_size` before processing.

### Frontend Enforcement in Streamlit

Streamlit-based UI components in `web/pipelines/` (including [`asset_based.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/asset_based.py) and [`digital_human.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/digital_human.py)) access the same `APIConfig` via the shared Python package. This allows frontend code to:

- Display the current limit to users
- Perform pre-flight client-side validation
- Handle server-side rejection gracefully

### Task Queue Integration

The [`api/tasks/manager.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/tasks/manager.py) module consults `max_upload_size` when queuing background tasks that involve uploaded assets, preventing oversized files from entering the processing pipeline.

## Validating Uploads Against the Limit: Code Examples

These practical patterns demonstrate how to work with Pixelle-Video's default file upload limit in both backend and frontend contexts.

### Backend Validation Pattern

```python
from pixelle_video.api.config import api_config

def validate_upload(file_bytes: bytes) -> None:
    """Raise ValueError if file exceeds the platform upload limit."""
    if len(file_bytes) > api_config.max_upload_size:
        max_mb = api_config.max_upload_size // (1024 * 1024)
        raise ValueError(
            f"File size exceeds the allowed limit of {max_mb} MB"
        )
    # Proceed with processing...

```

### Streamlit Frontend Integration

```python
import streamlit as st
from pixelle_video.api.config import api_config

# Convert bytes to MB for user-friendly display

max_mb = api_config.max_upload_size // (1024 * 1024)

uploaded = st.file_uploader(
    f"Upload your asset (max {max_mb} MB)",
    type=["png", "jpg", "jpeg", "mp4", "mov", "wav", "mp3"]
)

if uploaded is not None:
    # Double-check size (Streamlit client-side validation may vary by version)

    if uploaded.size > api_config.max_upload_size:
        st.error(f"Selected file exceeds the {max_mb} MB upload limit.")
    else:
        st.success(f"File accepted: {uploaded.name}")
        # Proceed with API call...

```

## Key Configuration Files Reference

| File Path | Purpose |
|-----------|---------|
| [[`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py)](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) | Defines `APIConfig.max_upload_size` (100 MB default) |
| [`api/app.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/app.py) | FastAPI initialization with configuration propagation |
| [`web/pipelines/asset_based.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/web/pipelines/asset_based.py) | Streamlit UI for asset uploads |
| [`web/pipelines/digital_human.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/web/pipelines/digital_human.py) | Streamlit UI for digital human pipeline uploads |
| [`api/tasks/manager.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/tasks/manager.py) | Task queue integration with size validation |

## Summary

- **Pixelle-Video's default file upload limit is 100 MB**, defined as `100 * 1024 * 1024` bytes in [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py).
- The `APIConfig` class centralizes this setting, ensuring consistent enforcement across FastAPI backends, Streamlit frontends, and background task queues.
- Developers should import `api_config` from `pixelle_video.api.config` to access the current limit programmatically rather than hardcoding values.
- File path references: configuration lives in [[`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py)](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py), with consumption patterns visible in [`api/app.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/app.py), `web/pipelines/` modules, and [`api/tasks/manager.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/tasks/manager.py).

## Frequently Asked Questions

### Can the default upload limit be increased or customized?

Yes. Since `max_upload_size` is a Pydantic field on `APIConfig`, you can instantiate a custom configuration with a different value. However, doing so requires ensuring all consuming components (backend, frontend, task workers) use the same configuration instance to avoid inconsistent enforcement.

### Does Pixelle-Video have separate limits for different file types?

No. The current implementation uses a single `max_upload_size` value that applies uniformly to all uploads—images, videos, audio, and other asset types. Type-specific validation (e.g., format restrictions) exists in pipeline code, but size enforcement is global.

### How does the frontend know the current upload limit?

Streamlit components import `api_config` from `pixelle_video.api.config` and read `max_upload_size` dynamically. This allows the UI to display the correct limit to users and perform client-side validation before sending data to the backend.

### What happens if a file exceeds the upload limit?

The backend raises a validation error (typically through FastAPI's request handling or explicit checks in route handlers), returning an HTTP 422 or 413 response. Frontend components catch oversized selections before submission and display user-friendly error messages.