Skip to main content

No project description provided

Project description

streamlit-fesion

Streamlit component for frontend computer vision processing with Wasm/Pyodide.

Sister project: streamlit-webrtc


You write an image filter function in Python that receives an image frame, transforms it, and returns a processed image frame. streamlit-fesion exports it to the frontend environment and executes it with Pyodide to process the WebCam video stream.

Look at the code below. It is a grayscale filter example.

from streamlit_fesion import streamlit_fesion


def image_filter(input_image):
    import skimage

    grayscale = skimage.color.rgb2gray(input_image)
    return skimage.color.gray2rgb(grayscale)


streamlit_fesion(image_filter, [], key="fesion")

image_filter() is the filter function. streamlit-fesion will call it with an input image frame of type np.ndarray with 3 channels (RGB-ordered), and the filter function returns a processed image frame with the same type and shape.

Note that the image_filter() will be sent to the frontend environment and executed there, but any other parts of the code will not. Therefore, the packages used in the filter function must be imported inside it, like import skimage in the example above.

streamlit-fesion automatically detects the imported packages and installs them to the frontend environment at the initialization time[^1]. However, if necessary, you can explicitly pass the requirements list to the second argument of streamlit_fesion(), where an empty list [] is passed in the example above.

[^1]:pyodide.loadPackagesFromImports is used for it.

The signature of streamlit_fesion() follows.

streamlit_fesion(
    filter_func: Callable[[np.ndarray], np.ndarray],
    dep_packages: Optional[List[str]] = None,
    key: Optional[str] = None,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_fesion-0.5.5.tar.gz (129.2 kB view details)

Uploaded Source

Built Distribution

streamlit_fesion-0.5.5-py3-none-any.whl (129.5 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_fesion-0.5.5.tar.gz.

File metadata

  • Download URL: streamlit_fesion-0.5.5.tar.gz
  • Upload date:
  • Size: 129.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.2 Linux/6.5.0-1015-azure

File hashes

Hashes for streamlit_fesion-0.5.5.tar.gz
Algorithm Hash digest
SHA256 da7ebd858d83f778b9626ad6b330eb3debec2efa3008d00b0dd23fe4795345d0
MD5 120aa04e4dc2d9022860e016225fcc12
BLAKE2b-256 f147429e6306d44671252d6b455de4d424bc163f5f9dea8dec7a00ee3e8d13a1

See more details on using hashes here.

File details

Details for the file streamlit_fesion-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: streamlit_fesion-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 129.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.2 Linux/6.5.0-1015-azure

File hashes

Hashes for streamlit_fesion-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 59b512e1a44b8305e265c1d77780c47692906a3c256a439f41d5251f8f7bc925
MD5 bdb8f422a9cfc4675278dfbab0642fc0
BLAKE2b-256 25bfec37c4618108c7576b4e4c185faddc4743e85b7ff1775c926ca5ddd7e534

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page