Downloads · 30 days
0
nzmarkyin/courier
courier is a machine learning model from nzmarkyin. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This script predicts the CHINESE express company based on a given tracking number. It uses a pre-trained model and a vectorizer to convert the tracking number into numeric features and then predicts the company using…
Downloads · 30 days
0
Access
Public
Updated Apr 23, 2023
Repo size
53.8 MB
Likes
0
Public
Click a slice to open those files.
.pkl36.1 MB · 67%
From the Hugging Face model README
This script predicts the CHINESE express company based on a given tracking number. It uses a pre-trained model and a vectorizer to convert the tracking number into numeric features and then predicts the company using the model.
To install the dependencies, run:
pip install scikit-learn joblib
import pickle
import sys
def predict_express_company(tracking_number):
# Load the trained model and vectorizer
with open("model.pkl", "rb") as model_file:
classifier = pickle.load(model_file)
with open("vectorizer.pkl", "rb") as vectorizer_file:
vectorizer = pickle.load(vectorizer_file)
# Convert the input tracking number into numeric features
tracking_number_vec = vectorizer.transform([tracking_number])
# Use the model for prediction
predicted_company = classifier.predict(tracking_number_vec)
return predicted_company[0]
if __name__ == "__main__":
if len(sys.argv) > 1:
tracking_number = sys.argv[1]
result = predict_express_company(tracking_number)
print(f"The predicted express company is: {result}")
else:
print("Please enter a tracking number.")