Reverse Browser: Vector-Image-to-Code Generator
Paper • 2509.05394 • Published
How to use tcz/rb-llama-90b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="tcz/rb-llama-90b")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
pipe(text=messages) # Load model directly
from transformers import AutoProcessor, AutoModelForImageTextToText
processor = AutoProcessor.from_pretrained("tcz/rb-llama-90b")
model = AutoModelForImageTextToText.from_pretrained("tcz/rb-llama-90b")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use tcz/rb-llama-90b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tcz/rb-llama-90b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tcz/rb-llama-90b",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'docker model run hf.co/tcz/rb-llama-90b
How to use tcz/rb-llama-90b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tcz/rb-llama-90b" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tcz/rb-llama-90b",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "tcz/rb-llama-90b" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tcz/rb-llama-90b",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'How to use tcz/rb-llama-90b with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for tcz/rb-llama-90b to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for tcz/rb-llama-90b to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for tcz/rb-llama-90b to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="tcz/rb-llama-90b",
max_seq_length=2048,
)How to use tcz/rb-llama-90b with Docker Model Runner:
docker model run hf.co/tcz/rb-llama-90b
This is a vector-to-ui model. It was fine-tuned on the HTML+CSS code of hundreds of thousands of public web pages and their SVG counterparts.
The goal of the model is to aid rapid prototyping and web development.
The model was trained on mobile resolution (393×852) SVGs only. Its test set accuracy was 0.3012 LPIPS (AlexNet). This suggests that it is not ready for industrial use in a real workflow, but it may serve research purposes.
!pip install vllm
from vllm import LLM, SamplingParams
llm = LLM(
"tcz/rb-llama-90b",
tensor_parallel_size=4, # The was tested on four H100s (96GB) GPUs
dtype="bfloat16",
gpu_memory_utilization=0.9,
enforce_eager=True,
max_model_len=12_000,
max_num_seqs=64,
)
data_prompt = """Your job is to take an SVG file of a web design and convert it into a pixel-perfect HTML and CSS markup and stylesheet.
### Input:
{}
### Response:
{}"""
max_tokens = 12_000
# Experiment with different temperature and top-p settings
sampling_params = SamplingParams(
temperature = 0.0,
top_p = 1.0,
top_k = 1,
n = 1,
max_tokens = max_tokens,
seed = 0
)
prompt = data_prompt.format(
YOUR_SVG_CONTENT,
"",
)
output = llm.generate([prompt], sampling_params)
print(output[0].outputs[0].text)
Base model
meta-llama/Llama-3.2-90B-Vision-Instruct