Views
No views yet
1import joblib
2import os
3from huggingface_hub import hf_hub_download
4
5# Define the missing custom function required by the unpickler
6def advanced_clean(text):
7 return text
8
9# Assign it to __main__ to ensure joblib can find it during loading
10import __main__
11__main__.advanced_clean = advanced_clean
12
13# Repository and filename
14repo_id = 'Phase-Technologies/netuark-classifier-ensemble'
15filename = 'netuark_ensemble_classifier.joblib'
16
17try:
18 # Download the file from Hugging Face
19 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
20
21 # Load the model
22 model = joblib.load(file_path)
23 prediction = model.predict(["📰 Perplexity's 'Personal Computer' Lets AI Agents Access Your Local Files #slashdot"])
24 print(f"Prediction: {prediction}")
25except Exception as e:
26 import traceback
27 print(f"An error occurred: {e}")
28 traceback.print_exc()