# Example Code: Test this code on colab
# Step 1: Install required libraries
!pip install ultralytics
!pip install huggingface_hub
# Step 2: Download the model from Hugging Face
from huggingface_hub import hf_hub_download
# Replace "krishnamishra8848/Nepal_Vehicle_License_Plates_Detection_Version3" with your model's Hugging Face repo ID
repo_id = "krishnamishra8848/Nepal_Vehicle_License_Plates_Detection_Version3"
model_path = hf_hub_download(repo_id=repo_id, filename="best.pt")
print(f"Model downloaded and saved at: {model_path}")
# Step 3: Load the model
from ultralytics import YOLO
model = YOLO(model_path) # Load the model
# Step 4: Upload an image for inference
from google.colab import files
import matplotlib.pyplot as plt
import cv2
# Allow user to upload an image
uploaded = files.upload()
# Get the uploaded file's path
image_path = list(uploaded.keys())[0]
# Step 5: Perform inference
results = model.predict(source=image_path)
# Step 6: Display the results
# Extract the annotated image
annotated_image = results[0].plot()
# Display the image with bounding boxes
plt.figure(figsize=(10, 10))
plt.imshow(cv2.cvtColor(annotated_image, cv2.COLOR_BGR2RGB))
plt.axis("off")
plt.show()
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
HF Inference API was unable to determine this model's library.