Instructions to use harriskr14/garbage_classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use harriskr14/garbage_classifier with timm:
import timm model = timm.create_model("hf_hub:harriskr14/garbage_classifier", pretrained=True) - Notebooks
- Google Colab
- Kaggle
| license: mit | |
| pipeline_tag: text-classification | |
| tags: | |
| - model_hub_mixin | |
| - pytorch_model_hub_mixin | |
| language: | |
| - en | |
| metrics: | |
| - accuracy | |
| - precision | |
| - recall | |
| - f1 | |
| base_model: | |
| - google/vit-base-patch16-224 | |
| library_name: timm | |
| This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration: | |
| - Code: https://huggingface.co/harriskr14/garbage_classifier | |
| - Paper: [More Information Needed] | |
| - Docs: [More Information Needed] | |
| # **How to use this model?** | |
| Write this following code on your file: | |
| **`app.py`** | |
| ``` | |
| def build_model(num_classes=10): | |
| config = get_config() | |
| model_name = 'vit_base_patch16_224' | |
| model = timm.create_model(model_name, pretrained=True, num_classes=num_classes) | |
| return model | |
| class MyModel(nn.Module, PyTorchModelHubMixin, repo_url="https://huggingface.co/harriskr14/garbage_classifier", pipeline_tag="text-classification", license="mit"): | |
| def __init__(self, num_classes=10): | |
| super(MyModel, self).__init__() | |
| self.model = build_model(num_classes=num_classes) | |
| def forward(self, x): | |
| return self.model(x) | |
| model = MyModel() | |
| model.from_pretrained("harriskr14/garbage_classifier") | |
| ``` |