Image-Text-to-Text
MLX
Safetensors
qwen3_5
clairic
cloudflare
systemone
structured-output
information-extraction
multimodal
custom-code
conversational
4-bit precision
Instructions to use mlx-community/clairic-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/clairic-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("mlx-community/clairic-4bit") config = load_config("mlx-community/clairic-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use mlx-community/clairic-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/clairic-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlx-community/clairic-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use mlx-community/clairic-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/clairic-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mlx-community/clairic-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/clairic-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/clairic-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mlx-community/clairic-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download clairic_runtime/html_rows.py from mlx-community/clairic-4bit: direct link, hf CLI and curl.
- Browser
- Download file 4.92 kB
-
https://huggingface.co/mlx-community/clairic-4bit/resolve/main/clairic_runtime/html_rows.py
- Command line
-
hf download hf://mlx-community/clairic-4bit/clairic_runtime/html_rows.py
-
curl -L -o html_rows.py https://huggingface.co/mlx-community/clairic-4bit/resolve/main/clairic_runtime/html_rows.py
4.92 kB
| from __future__ import annotations | |
| import re | |
| from html.parser import HTMLParser | |
| from typing import Any | |
| class _Tables(HTMLParser): | |
| def __init__(self, source: str) -> None: | |
| super().__init__(convert_charrefs=True) | |
| self.source = source | |
| self.offsets = [0] | |
| self.offsets.extend((match.end() for match in re.finditer("\n", source))) | |
| self.tables: list[list[dict[str, Any]]] = [] | |
| self.table: list[dict[str, Any]] | None | |
| self.row: list[str] | None | |
| self.cell: list[str] | None | |
| self.cell_tag: str | None | |
| self.cell_parts: list[tuple[str, int]] | None | |
| self.row_spans: list[list[int] | None] | None | |
| self.table = self.row = self.cell = None | |
| self.cell_tag = self.cell_parts = self.row_spans = None | |
| self.row_start: int | None = None | |
| self.depth = 0 | |
| self.invalid = False | |
| def position(self) -> int: | |
| (line, column) = self.getpos() | |
| return self.offsets[line - 1] + column | |
| def handle_starttag( | |
| self, tag: str, attrs: list[tuple[str, str | None]] | dict[str, str | None] | |
| ) -> None: | |
| if tag == "table": | |
| self.depth += 1 | |
| if self.depth != 1: | |
| self.invalid = True | |
| else: | |
| self.table = [] | |
| if not self.depth: | |
| return | |
| attrs = dict(attrs) | |
| if ( | |
| "hidden" in attrs | |
| or (attrs.get("aria-hidden") or "").lower() == "true" | |
| or re.search( | |
| "(?:display\\s*:\\s*none|visibility\\s*:\\s*hidden)", | |
| attrs.get("style") or "", | |
| re.IGNORECASE, | |
| ) | |
| or (tag in ("script", "style")) | |
| ): | |
| self.invalid = True | |
| if tag == "tr": | |
| if self.row is not None or self.cell is not None: | |
| self.invalid = True | |
| (self.row, self.row_start, self.row_spans) = ([], self.position(), []) | |
| elif tag in ("td", "th"): | |
| if self.row is None or self.cell is not None: | |
| self.invalid = True | |
| if attrs.get("rowspan", "1") != "1" or attrs.get("colspan", "1") != "1": | |
| self.invalid = True | |
| (self.cell, self.cell_tag, self.cell_parts) = ([], tag, []) | |
| elif tag in ("br", "p", "div", "ul", "ol", "li") and self.cell is not None: | |
| self.cell.append(" ") | |
| def handle_data(self, data: str) -> None: | |
| if self.cell is not None: | |
| self.cell.append(data) | |
| self.cell_parts.append((data, self.position())) | |
| elif self.row is not None and data.strip(): | |
| self.invalid = True | |
| def handle_endtag(self, tag: str) -> None: | |
| if not self.depth: | |
| return | |
| if tag in ("td", "th"): | |
| if self.cell is None or self.row is None or tag != self.cell_tag: | |
| self.invalid = True | |
| else: | |
| value = re.sub("\\s+", " ", "".join(self.cell)).strip() | |
| self.row.append(value) | |
| matches = [ | |
| position + data.find(value) | |
| for (data, position) in self.cell_parts | |
| if value | |
| and data.count(value) == 1 | |
| and self.source.startswith(value, position + data.find(value)) | |
| ] | |
| self.row_spans.append( | |
| [matches[0], matches[0] + len(value)] if len(matches) == 1 else None | |
| ) | |
| self.cell = self.cell_tag = self.cell_parts = None | |
| elif tag == "tr": | |
| if self.row is None or self.cell is not None or self.table is None: | |
| self.invalid = True | |
| else: | |
| end = self.source.find(">", self.position()) + 1 | |
| self.table.append( | |
| { | |
| "cells": self.row, | |
| "line": self.source[self.row_start : end], | |
| "offset": self.row_start, | |
| "spans": self.row_spans, | |
| } | |
| ) | |
| self.row = self.row_start = self.row_spans = None | |
| elif tag == "table": | |
| if self.depth == 1: | |
| if self.row is not None or self.cell is not None: | |
| self.invalid = True | |
| self.tables.append(self.table) | |
| self.table = None | |
| self.depth -= 1 | |
| elif tag in ("p", "div", "ul", "ol", "li") and self.cell is not None: | |
| self.cell.append(" ") | |
| def tables(source: str) -> list[list[dict[str, Any]]] | None: | |
| parser = _Tables(source) | |
| try: | |
| parser.feed(source) | |
| parser.close() | |
| except (ValueError, TypeError): | |
| return None | |
| if ( | |
| parser.invalid | |
| or parser.depth | |
| or parser.row is not None | |
| or (parser.cell is not None) | |
| ): | |
| return None | |
| return parser.tables | |