Image-Text-to-Text
Safetensors
MLX
Arabic
mlx-vlm
qwen3_vl
vision
ocr
arabic
arabic-ocr
conversational
4-bit precision
Instructions to use Alsamir/Abjad_0.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Alsamir/Abjad_0.2 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("Alsamir/Abjad_0.2") config = load_config("Alsamir/Abjad_0.2") # 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 Alsamir/Abjad_0.2 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Alsamir/Abjad_0.2"
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": "Alsamir/Abjad_0.2" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use Alsamir/Abjad_0.2 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 "Alsamir/Abjad_0.2"
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 Alsamir/Abjad_0.2
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Alsamir/Abjad_0.2 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Alsamir/Abjad_0.2"
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 "Alsamir/Abjad_0.2" \ --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 abjad_convert.py from Alsamir/Abjad_0.2: direct link, hf CLI and curl.
- Browser
- Download file 2.66 kB
-
https://huggingface.co/Alsamir/Abjad_0.2/resolve/main/abjad_convert.py
- Command line
-
hf download hf://Alsamir/Abjad_0.2/abjad_convert.py
-
curl -L -o abjad_convert.py https://huggingface.co/Alsamir/Abjad_0.2/resolve/main/abjad_convert.py
2.66 kB
| #!/usr/bin/env python3 | |
| """One-command Arabic scanned document conversion to editable RTL Word.""" | |
| import argparse, json, subprocess, tempfile | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent | |
| BUNDLED_PYTHON = Path("/Users/abdulrahmanalshehry/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/bin/python3") | |
| def main(): | |
| ap = argparse.ArgumentParser(description="Convert Arabic images, scanned PDFs, or scanned Word files to RTL DOCX") | |
| ap.add_argument("input", type=Path); ap.add_argument("output", type=Path) | |
| ap.add_argument("--dpi", type=int, default=150); ap.add_argument("--resume", action="store_true"); ap.add_argument("--layout", action="store_true", help="Use Abjad vision layout mode for tables and structured pages"); ap.add_argument("--trained", action="store_true", help="Use the trained MLX LoRA adapter instead of fast macOS Vision") | |
| args = ap.parse_args() | |
| with tempfile.TemporaryDirectory(prefix="abjad-convert-") as td: | |
| temp = Path(td); text = temp / "ocr.txt" | |
| venv_python = ROOT / ".venv" / "bin" / "python" | |
| word_python = str(BUNDLED_PYTHON) if BUNDLED_PYTHON.exists() else "python3" | |
| python = str(venv_python) if args.trained and venv_python.exists() else word_python | |
| if args.layout and args.trained: | |
| ap.error("--layout and --trained are mutually exclusive") | |
| if args.layout: | |
| subprocess.run([python, str(ROOT / "extract_to_word.py"), str(args.input), "-o", str(args.output), "--model", "Abjad_0.1", "--dpi", str(args.dpi)], check=True) | |
| print(json.dumps({"word_output": str(args.output), "mode": "layout"}, ensure_ascii=False)); return | |
| engine = "macOS Vision Arabic OCR" | |
| pipeline = ROOT / "vision_pipeline.py" | |
| if args.trained: | |
| pipeline = ROOT / "mlx_ocr_pipeline.py" | |
| engine = "Abjad MLX LoRA Arabic OCR" | |
| command = [python, str(pipeline), str(args.input), "-o", str(text), "--dpi", str(args.dpi)] | |
| if args.trained: | |
| command.extend(["--adapter", str(ROOT / "adapters")]) | |
| if args.resume: command.append("--resume") | |
| subprocess.run(command, check=True) | |
| subprocess.run([word_python, str(ROOT / "text_to_word.py"), str(text), str(args.output)], check=True) | |
| report = json.loads((text.with_suffix(".progress.json")).read_text(encoding="utf-8")) | |
| report["word_output"] = str(args.output) | |
| args.output.with_suffix(".quality.json").write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8") | |
| print(json.dumps(report, ensure_ascii=False, indent=2)) | |
| if __name__ == "__main__": main() | |