Unique Interface
Build a browser interface for a Python function, chat model, or file-review tool. Run it locally, share a temporary URL, or deploy the app in a Docker Space. 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.
Developer guide · Python package on PyPI · Docker image on GitHub Packages
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.
Function apps in 0.1.6
Use a dropdown, radio buttons, checkbox group, color picker, code box, or editable table in a Python app. Table inputs arrive as rows of cell text. Line and bar plots accept numeric sequences. Scatter plots accept pairs of coordinates.
from unique_interface import Dataframe, Interface, ScatterPlot
def plot(rows):
return [(float(x), float(y)) for x, y in rows]
demo = Interface(plot, Dataframe(["X", "Y"]), ScatterPlot(),
examples=[[[["1", "3"], ["2", "5"]]]], theme="auto")
demo.launch()
Use Add row or load the example, edit the cells, then click Run. With cache_examples=True, Python computes the supplied examples at app construction and reuses their results for matching requests. Use caching for deterministic callbacks.
- Compose function apps with
TabbedInterface([app1, app2], ["First", "Second"]). Named endpoints are prefixed by their zero-based tab number, such astab0_predict. - Add
GroupandAccordionlayouts insideBlocks. Bind a component with.change(fn, inputs, outputs),.submit(...)for Enter, or.upload(...)for files. Usetheme="light","dark", or"auto"on the outer app. - Open Use via API in a function app to inspect its endpoints and send JSON requests. In Python, use
Client(url).schema()andClient(url).predict(*values, api_name="predict")after importingClientfromunique_interface. Responses includeoutputsandduration_ms. - Same-origin JavaScript can use
import {Client} from "/client.mjs"andawait new Client(location.origin).predict([value]). This module is served by the running app. - Control concurrent callbacks with
launch(concurrency_limit=2, max_pending=4). When the running and waiting slots are full, another request receives HTTP 429. The default runs one callback at a time. Increase concurrency only for callbacks that support concurrent use.
Metadata
Release files for unique-interface 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unique_interface-0.1.6.tar.gz | 39.4 kB | With provenance | Details for unique_interface-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unique_interface-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for unique_interface-0.1.6-py3-none-any.whl |
Total release size: 75.5 kB
Release files / unique_interface-0.1.6.tar.gz
| Download URL | unique_interface-0.1.6.tar.gz |
|---|---|
| Size | 39.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
344aa2cb00ef4f9417071be443222d0420f5b55434cf7ea79e4e65f556120d4c
|
|
BLAKE2b-256 checksum How to use checksums |
f0f00ecb5b3cf0407d6e01779d1e6cfc8f21b9ade4c9907d1466273e1b69a5aa
|
| 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 logRelease files / unique_interface-0.1.6-py3-none-any.whl
| Download URL | unique_interface-0.1.6-py3-none-any.whl |
|---|---|
| Size | 36.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90e4c1f17847fe97742f5831317098ee764a5ce75c7438a19ebd33ccb0961d65
|
|
BLAKE2b-256 checksum How to use checksums |
0618316a9b1a75a2e01528f98245fd8615c5f3c84ecf7f5f3d480249ad2487eb
|
| 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 logSecurity for unique-interface 0.1.6
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.
Attestation for unique_interface-0.1.6.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 logA 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.