Downloads · 30 days
30
18% of all-time downloads
joaocarlosnb/genai-smartcity-classifier
genai-smartcity-classifier is a zero-shot classification model from joaocarlosnb. Use it when you need labels you did not train the model on. The card lists the license as mit.
Binary transformer classifier detecting whether a text describes a Generative AI (GenAI) application in a smart city context.
Downloads · 30 days
30
18% of all-time downloads
All-time downloads
167
Public
Parameters
184M
740 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors738 MB · 99%
From the Hugging Face model README
Binary transformer classifier detecting whether a text describes a Generative AI (GenAI) application in a smart city context.
The full codebase can be found here.
id2label = {0: "GenAI used for smart city application", 1: "Not related"}
import torch
from transformers import DebertaV2Tokenizer, AutoModelForSequenceClassification
MODEL_ID = "joaocarlosnb/genai-smartcity-classifier" # replace with actual repo id
TEMP = 0.602
id2label = {0: "GenAI used for smart city application", 1: "Not related"}
tokenizer = DebertaV2Tokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
model.eval()
def predict(text, max_length=256, apply_temp=True):
inputs = tokenizer(text, truncation=True, padding="max_length",
max_length=max_length, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
if apply_temp:
logits = logits / TEMP
probs = torch.softmax(logits, dim=-1)[0]
top = int(probs.argmax())
return {
"label": id2label[top],
"probabilities": {id2label[i]: float(p) for i, p in enumerate(probs)}
}
print(predict("We apply a diffusion model to simulate traffic for urban planning."))
pip install transformers torch
Short technical sentences or abstract fragments (English). Truncate >512 tokens automatically.
Research, corpus analysis, and exploratory filtering. Human review is recommended before operational deployment.
Training data hosted separately (same namespace). Contains augmented, adaptive, contrastive, and diagnostic subsets.
Set seed=42. Use DebertaV2Tokenizer with max_length=512 for full retraining.
Bittencourt, J. C. N., Flores, T. K. S., Jesus, T. C., & Costa, D. G. (2025). On the Role of AI in Building Generative Urban Intelligence. In Review. https://doi.org/10.21203/rs.3.rs-7131966/v1
See repository LICENSE (ensure compatibility with upstream model license).
Do not hard-code Hugging Face tokens. Use environment variable: `export