Skip to main content

Tesseract Streamlit

A CLI tool that generates a Streamlit app from a running Tesseract instance. The generated app allows users to interactively submit input to the apply endpoint and optionally visualise results using custom plotting functions.

✨ Features

  • 🔍 Parses Tesseract's OpenAPI schema
  • ⚙️ Automatically builds input forms for the apply endpoint
  • 📊 Supports user-defined plotting of inputs and outputs
  • 🚀 Outputs a ready-to-run Streamlit app script
  • 🧩 Modular and customizable with minimal boilerplate

🛠 Requirements

  • Modern UNIX based OS (Linux or macOS), or Windows with WSL
  • Python >= 3.10
  • tesseract-core

📦 Installation

$ pip install tesseract-streamlit

🧰 Usage

$ tesseract-streamlit [OPTIONS] [URL] [OUTPUT]
  • URL: The address to the Tesseract instance you want to interface with. Not needed with --from-image.
  • OUTPUT: (Optional) The file path to write the generated Streamlit app. When omitted, the app is written to a cache file and Streamlit is launched automatically.

Quick start

If you've got a running Tesseract, you can get started fast by simply passing in its URL.

$ tesseract-streamlit http://127.0.0.1:61725

This generates the app and launches Streamlit in one step.

Or, skip serving the Tesseract yourself entirely:

$ tesseract-streamlit --from-image vectoradd

This serves the Tesseract from the given image, generates the app, and launches Streamlit, in a single command.

Full example

# Install dependencies
$ pip install tesseract-core tesseract-streamlit

# Clone Tesseract Core and build example Tesseract
$ git clone https://github.com/pasteurlabs/tesseract-core.git
$ tesseract build tesseract-core/examples/vectoradd

# Option A: Serve yourself and auto-launch the app
$ tesseract serve vectoradd --port 61725
$ tesseract-streamlit http://127.0.0.1:61725

# Option B: Let tesseract-streamlit handle everything
$ tesseract-streamlit --from-image vectoradd

# Option C: Generate a script to run later
$ tesseract serve vectoradd --port 61725
$ tesseract-streamlit http://127.0.0.1:61725 app.py
$ streamlit run app.py

⚙️ Options

Option Description
--from-image (Optional) Tesseract image to serve automatically
--user-code, -u (Optional) Path to Python file with plotting functions
--layout (Optional) App layout: two-column (default) or simple
--help Show the help message and exit

🖼 Layouts

Choose how inputs and outputs are arranged with --layout:

$ tesseract-streamlit --layout simple http://localhost:48819
two-column (default) simple
Two-column layout Simple layout
Inputs and outputs side-by-side, each scrolling independently — tweak inputs while keeping results in view. Inputs stacked above outputs in one centered column — simpler, and easier to read with many plots.

📊 With Custom Plotting

You can optionally pass a Python file containing user-defined functions for plotting inputs and/or outputs.

$ tesseract-streamlit --user-code udf.py http://localhost:48819

The udf.py file should define functions like:

import plotly.graph_objects as go

def plot(inputs, outputs) -> go.Figure:
    """Title of the plot.

    Description of what the plot conveys. Will be displayed above the
    plot itself.
    """
    fig = go.Figure()
    # some plotly logic to visualise input_schema and output_schema
    return fig

Where we have chosen Plotly as our plotting back-end, but any supported library by Streamlit is allowed.

⚙️ More info on defining custom plotting functions

Custom plotting is easy and flexible. Here’s how to make the most of it:

  • Function names don't matter, so name them however you like.
  • Define multiple functions to visualise more than one aspect of the data. Each one will generate a separate plot in the Streamlit app.
  • Add a docstring to each function to add descriptive text in the app:
    • First line of the docstring will appear as the plot title.
    • Remaining lines will be shown as a description below the title.
    • Omitting docstrings is allowed, but raises a UserDefinedFunctionWarning.
  • Public functions must include either inputs, outputs, or both as parameter names. Any public function that doesn't use these names will raise a UserDefinedFunctionError.
  • Private functions may be defined with a leading underscore in their name, eg. def _foo(x: float) -> float: ....
    • Arbitrary parameters and return types are allowed.
    • Will not produce plots directly in the Web UI.
    • Can be called from within your public plotting functions.

This setup gives you control over what to display and how to explain it, directly from your code.

📁 Example

See the example README for a basic example walk-through, or simply run the following script to see the end result!

$ bash examples/vectoradd_jax/run.sh

This will open a browser window with the Streamlit UI where users can input values and visualise the response.

⚠️ Current Limitations

While tesseract-streamlit supports Tesseracts with an InputSchema formed with arbitrary nesting of Pydantic models, it does not yet support nesting Pydantic models inside native Python collection types such as:

  • ❌ list[Model]
  • ❌ tuple[Model, ...]
  • ❌ dict[str, Model]

These types will raise an error or be ignored in the generated app.

You can however use these native collections with basic Python types, such as:

  • ✅ list[str]
  • ✅ dict[str, int]
  • ✅ tuple[float, float]

If you would like to request support for nested models within collections in a future release, please let us know.

Metadata

Release files for tesseract-streamlit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tesseract-streamlit 0.2.1
File Size Uploaded
tesseract_streamlit-0.2.1.tar.gz 410.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tesseract-streamlit 0.2.1
File Interpreter ABI Platform
tesseract_streamlit-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 653.4 kB

Release files / tesseract_streamlit-0.2.1.tar.gz

Download URL tesseract_streamlit-0.2.1.tar.gz
Size 410.6 kB
Tags Source
SHA-256 checksum
How to use checksums
72607a806b52bc03378f41adcd7c7babdea9d9a1b0b1239a569716c153b6ebf5
BLAKE2b-256 checksum
How to use checksums
f0a159869236dd0c4355086bdab7e6a382f126dab6c62f7ba27069f73530d373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / tesseract_streamlit-0.2.1-py3-none-any.whl

Download URL tesseract_streamlit-0.2.1-py3-none-any.whl
Size 242.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b883f72e20c6d1baf1560232f8dcc5fdf3a248d433c2d1da917322eb2c147da
BLAKE2b-256 checksum
How to use checksums
d354f56e3541870ba14e934ca287f260a825bbbe72e45e7d345bc03a7e448747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page