Skip to main content

Unique Interface

A compact, monochrome interface for Python chat and file-review tools. The notebook chat is centered and capped at 800 px, with a 144 px conversation sidebar on larger screens. User prompts appear on the right, answers on the left. Press Enter to send. Retry replaces the last answer, and New chat starts a separate conversation in the current session.

Try the public UniqueChat Space · Open UniqueChat in Colab · Open SheetReview in Colab

Install by name

In Colab, Jupyter or a VS Code notebook, run:

%pip -q install --upgrade unique-interface

In a terminal, run python -m pip install --upgrade unique-interface. Restart an already-running kernel if it imported an older release before the upgrade.

Show a notebook chat

from unique_interface import ChatInterface

def answer(message, history):
    return f"You wrote: {message}"

chat = ChatInterface(answer, title="My chat").launch()

The example echoes text. Replace the callback with your model function to generate answers. It receives the current message and earlier role/content dictionaries. Return a string for a word-by-word reveal, or yield text chunks for live generation. In Colab, enable widgets before launch with from google.colab import output and output.enable_custom_widget_manager().

Open a full-page chat from a Python script

from unique_interface import serve

def answer(message, history):
    return f"You wrote: {message}"

serve(answer, title="My chat")

Run the script on your computer. A new browser tab opens at the printed loopback URL. Each tab keeps its conversation in memory. Stop the server with Ctrl+C. The full-page composer supports Enter to send and Shift+Enter for a new line. A hosted Colab runtime has its own loopback address, so use the inline widget or a deployed Space there.

Share a public or restricted URL

The public demo can be opened in a new tab or shared. To host your own copy, open the demo and choose Duplicate this Space from its menu. Choose Public for a shareable link or Private to let Hugging Face restrict access to authorized members. Each visitor starts their own conversation. Sharing a deployment link does not share a transcript.

To display links to your deployments in a notebook:

chat.set_links(
    public_url="https://huggingface.co/spaces/unique50101/UniqueChat",
    private_url="https://huggingface.co/spaces/YOUR-ORG/YOUR-PRIVATE-SPACE",
)

Replace the private URL with an actual access-controlled deployment or omit it. The link label alone grants no access control.

Build a Hugging Face Static Space with your model

from unique_interface import export_space

export_space("index.html", model="HuggingFaceTB/SmolLM2-135M-Instruct", title="My chat")

Run this in an empty directory, create a Static → Blank Space, and upload the generated index.html as its entry page. The exported app uses the bundled Unique Interface layout. It loads Transformers.js and a compatible ONNX text-generation model with a chat template and q4 weights into the visitor's browser. The first model load needs internet. For a Python-only model, use the Python callback in your own Python runtime. Static hosting runs JavaScript inference and does not execute Python callbacks.

Review and download a file

from unique_interface import FileInterface

def inspect_file(path, folder):
    return f"Received {path.stat().st_size} bytes", None

review = FileInterface(inspect_file, title="Inspect a file").launch()

Return a plain-text summary and an optional generated file path to show a download link. The default input limit is 10 MiB. SheetReview's notebook provides a complete CSV/XLSX example.

Share your own Python function

Visual documentation and interactive example

from unique_interface import Interface

def greet(name):
    return f"Hello, {name}!"

demo = Interface(greet, inputs="text", outputs="text", title="Greeting demo")
app = demo.launch(share=True)

Visitors to the printed public HTTPS URL call your running function. Keep the script or notebook runtime running. Each launch receives a local loopback URL. Sharing is opt-in and uses a temporary Cloudflare Quick Tunnel. On first use the package finds cloudflared on PATH or downloads and checksum-verifies the official helper on supported Windows, macOS and Linux systems. The machine must allow the helper to reach Cloudflare. Anyone with the public URL can invoke the callback. For a membership-restricted permanent URL, deploy a private Space. A loopback address on hosted Colab belongs to the runtime machine.

In notebooks, app.local_url and app.share_url are available on the returned handle. Call app.close() to end both routes. In scripts, launch blocks until Ctrl+C. Pass block=False to manage the app lifecycle yourself.

from unique_interface import ChatInterface
ChatInterface(lambda message, history: f"You wrote {message}").launch(share=True)

Inputs, outputs and layouts

Supply component types such as "text", "number", "checkbox", "json", "image", "audio", "video", and "file". Use Slider(1, 5) for bounded numeric input. Uploaded media arrives as Upload(name, mime, data); return an Upload to display or download generated media. Audio inputs also support microphone recording in compatible browsers with permission. Return a list of numeric values for a "chart" line plot. Multiple outputs use a tuple in declared order.

from unique_interface import Blocks, Tab, Row, Textbox, Button
with Blocks("Text tools") as demo:
    with Tab("Uppercase"), Row():
        source = Textbox("Input")
        result = Textbox("Result")
    Button("Convert").click(str.upper, source, result, api_name="upper")
demo.launch()

Call the generated API

GET /api/schema describes components and events. POST JSON to /api/predict for Interface, or /api/<api_name> for a named button callback. Example request: {"inputs":["Ada"]}. Example response: {"outputs":["Hello, Ada!"],"duration_ms":0.4}. For file inputs send {"name":"sample.txt","mime":"text/plain","data":"YWJj"} as the input value. Chat uses POST /reply with {"message":"Hi","history":[]}, returning newline-delimited JSON. The UI displays elapsed response time for successful runs.

Permanent Python deployment on Hugging Face

For a server-side Python callback, use a Docker Space if available on your account. For static browser inference, duplicate the UniqueChat Static Space described above. Hugging Face manages the global SDK picker. Unique Interface is installed or exported inside the chosen SDK.

Copy the Docker Space starter. Put its README.md, Dockerfile and app.py in the root of your Docker Space and edit predict. The starter calls launch(space=True) to serve the permanent Space address on port 7860.

Metadata

Release files for unique-interface 0.1.5

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

Source distribution (sdist)

Source distribution for unique-interface 0.1.5
File Size Uploaded Provenance Actions
unique_interface-0.1.5.tar.gz 32.2 kB With provenance Details for unique_interface-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unique-interface 0.1.5
File Interpreter ABI Platform Actions
unique_interface-0.1.5-py3-none-any.whl Python 3 none any Details for unique_interface-0.1.5-py3-none-any.whl

Total release size: 61.4 kB

Release files / unique_interface-0.1.5.tar.gz

Download URL unique_interface-0.1.5.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ac7e735a1db3e147c4107421650600ac96c61c9039ee3253fcb8afaf17f897ac
BLAKE2b-256 checksum
How to use checksums
040e57a816a6b4eb06f8a847f46f2ec72c9bcc5d7be82ee2cce25a73a87c8a7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / unique_interface-0.1.5-py3-none-any.whl

Download URL unique_interface-0.1.5-py3-none-any.whl
Size 29.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0af729e9767422303f1fe6f565f0a396c9f55a044745007c25f81e1eaed4dc70
BLAKE2b-256 checksum
How to use checksums
489d869d81ca1d587bc62e749be7f6fcab5424209a99f4b6ee249a931b6c382a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Security for unique-interface 0.1.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for unique_interface-0.1.5.tar.gz

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 Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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