CoolFace
Modelpublic

nexsendev/webicoder-v3-coreml

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes24downloads
Model Card

๐ŸŒ WebICoder v3 โ€” CoreML

Generate complete, production-ready HTML/CSS websites directly on your iPhone, iPad or Mac โ€” no internet required.

WebICoder v3 is a fine-tuned Phi-2 (2.7B parameters) model, optimized for on-device HTML code generation using Apple's CoreML framework.

๐Ÿ“ฆ Available Models

ModelSizePrecisionBest For
WebICoder-v3-fp16.mlpackage~5.5 GBFP16Mac (M1/M2/M3) โ€” maximum quality
WebICoder-v3-8bit.mlpackage~2.8 GBINT8iPad โ€” good quality, smaller
WebICoder-v3-4bit.mlpackage~1.4 GB4-bitiPhone โ€” smallest, good quality

๐Ÿš€ Quick Start (Swift / Xcode)

1. Download the model

bash
# Install Git LFS first
git lfs install
git clone https://huggingface.co/nexsendev/webicoder-v3-coreml

2. Add to your Xcode project

Drag the .mlpackage file into your Xcode project. Xcode will automatically compile it.

3. Run inference

swift
import CoreML
import Tokenizers

// Load model
let config = MLModelConfiguration()
config.computeUnits = .cpuAndNeuralEngine
let model = try MLModel(contentsOf: modelURL, configuration: config)

// Tokenize input
let tokenizer = try await AutoTokenizer.from(pretrained: "nexsendev/webicoder-v3-coreml")
let prompt = "Create a modern landing page for a coffee shop"
let inputIds = tokenizer.encode(text: prompt)

// Run inference
let inputArray = try MLMultiArray(shape: [1, inputIds.count as NSNumber], dataType: .int32)
for (i, id) in inputIds.enumerated() {
    inputArray[i] = NSNumber(value: id)
}

let prediction = try model.prediction(from: MLDictionaryFeatureProvider(
    dictionary: ["input_ids": inputArray, "attention_mask": maskArray]
))

๐Ÿ Usage with Python (macOS only)

python
import coremltools as ct
import numpy as np
from transformers import AutoTokenizer

# Load
model = ct.models.MLModel("WebICoder-v3-fp16.mlpackage")
tokenizer = AutoTokenizer.from_pretrained("nexsendev/webicoder-v3-coreml")

# Generate
prompt = "Create a modern landing page for a coffee shop with dark theme"
tokens = tokenizer.encode(prompt, return_tensors="np").astype(np.int32)
mask = np.ones_like(tokens, dtype=np.int32)

result = model.predict({"input_ids": tokens, "attention_mask": mask})
logits = result["logits"]

๐Ÿ’ฌ Prompt Format

The model works best with descriptive prompts:

Create a modern landing page for a coffee shop with:
- Dark theme with warm colors
- Hero section with a background image
- Menu section with cards
- Contact form
- Responsive design

The model will output a complete, standalone HTML file with embedded CSS.

โš™๏ธ Hardware Requirements

ModelMin RAMRecommended Device
FP166 GBMac M1/M2/M3/M4
8-bit3 GBiPad Pro, iPad Air
4-bit2 GBiPhone 15, iPhone 16

All models require iOS 17+ or macOS 14+.

๐Ÿ“ Details

  • โ€”Base model: microsoft/phi-2 (2.7B parameters)
  • โ€”Fine-tuning: Trained on curated HTML/CSS website examples
  • โ€”Input: Natural language description of a website
  • โ€”Output: Complete HTML with embedded CSS and JavaScript
  • โ€”Context length: 4096 tokens
  • โ€”License: MIT