Downloads · 30 days
27
100% of all-time downloads
CXu0630/poster-font-classifier
poster-font-classifier is a text classification model from CXu0630. Use it when you need a label for a piece of text. It is set up for transformers.
Fine-tuned distilbert-base-uncased that maps a natural-language poster brief to a font ('Font' column), for poster font recommendation.
Downloads · 30 days
27
100% of all-time downloads
All-time downloads
27
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
Fine-tuned distilbert-base-uncased that maps a natural-language poster brief to
a font ('Font' column), for poster font recommendation.
| metric | value |
|---|---|
| accuracy | 0.8939 |
| f1_macro | 0.8937 |
import json, torch
from huggingface_hub import hf_hub_download
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo = "CXu0630/poster-font-classifier"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo).eval()
cfg = json.load(open(hf_hub_download(repo, "inference_config.json")))
enc = tokenizer(["retro jazz night poster"], truncation=True, max_length=cfg["max_len"], return_tensors="pt")
with torch.no_grad():
logits = model(**enc).logits
probs = torch.softmax(logits, -1)[0]
print(sorted(((model.config.id2label[i], float(p)) for i, p in enumerate(probs)), key=lambda x: -x[1]))