Views
No views yet
labels.json (index ↔ label 1:1)1import json, torch, numpy as np
2from huggingface_hub import hf_hub_download
3from importlib.machinery import SourceFileLoader
4
5repo = "HyukII/audio-emotion-model"
6w = hf_hub_download(repo, "pytorch_model.pth")
7m = hf_hub_download(repo, "model.py")
8lab = hf_hub_download(repo, "labels.json")
9
10labels = json.load(open(lab, encoding="utf-8"))
11Model = SourceFileLoader("amodel", m).load_module().PyTorchAudioModel
12
13model = Model(num_labels=len(labels)).eval()
14state = torch.load(w, map_location="cpu")
15model.load_state_dict(state)
16# x: tensor (1,13,100) → probs = softmax(model(x), dim=1)