Instructions to use SupremoUGH/image-classification-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SupremoUGH/image-classification-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="SupremoUGH/image-classification-model") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("SupremoUGH/image-classification-model") model = AutoModelForImageClassification.from_pretrained("SupremoUGH/image-classification-model", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| import unittest | |
| import os | |
| from image_classification_model.predict import predict | |
| from image_classification_model.utils import ROOT_DIR | |
| DATA_DIR = os.path.join(ROOT_DIR, "tests/data") | |
| class TestPrediction(unittest.TestCase): | |
| def test_prediction_label_3(self): | |
| test_image_path = os.path.join(DATA_DIR, "number_3.jpg") | |
| predicted_label = predict(test_image_path) | |
| self.assertEqual( | |
| predicted_label, 3, f"Expected label 3, but got {predicted_label}" | |
| ) | |
| if __name__ == "__main__": | |
| unittest.main() | |