SMAD is an audio classification model for identifying speech, music, singing,
and non-vocal content in short audio segments. It is designed for lightweight
audio analysis workflows where fast, practical content categorization is
needed.
Load by model id
import torch
from transformers import AutoFeatureExtractor, AutoModelForAudioClassification
model_id = "duclvQ/smad"
feature_extractor = AutoFeatureExtractor.from_pretrained(
model_id,
trust_remote_code=True,
)
model = AutoModelForAudioClassification.from_pretrained(
model_id,
trust_remote_code=True,
).eval()
# `audio` must be mono float32 audio sampled at 16 kHz. For longer files, run# this over 4-second windows.
inputs = feature_extractor(audio, sampling_rate=16000, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.softmax(logits / model.config.temperature, dim=-1)
label_id = int(probs.argmax(-1)[0])
label = model.config.id2label[label_id]
confidence = float(probs[0, label_id])
For arbitrary file paths, load/resample with
librosa
:
smad huggingface.co is an AI model on huggingface.co that provides smad's model effect (), which can be used instantly with this duclvQ smad model. huggingface.co supports a free trial of the smad model, and also provides paid use of the smad. Support call smad model through api, including Node.js, Python, http.
smad huggingface.co is an online trial and call api platform, which integrates smad's modeling effects, including api services, and provides a free online trial of smad, you can try smad online for free by clicking the link below.
smad is an open source model from GitHub that offers a free installation service, and any user can find smad on GitHub to install. At the same time, huggingface.co provides the effect of smad install, users can directly use smad installed effect in huggingface.co for debugging and trial. It also supports api for free installation.