Thursday, 3 December 2026

Use a model from Hugging face

 Hi All

Try this


step1 - pip install huggingface_hub

step2 - code

from huggingface_hub import hf_hub_download
import pickle
model_path = hf_hub_download(
    repo_id="sajeevj/malware-detector",
    filename="model.pkl"
)
with open(model_path, "rb") as f:
    model = pickle.load(f)
prediction = model.predict([[10, 20, 30]])

print(prediction)

No comments:

Post a Comment