IceKhoffi commited on
Commit
ba61daa
·
verified ·
1 Parent(s): 992c1dc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +7 -3
README.md CHANGED
@@ -68,8 +68,10 @@ The Modified model was evaluated on a test set.
68
  You can load this trained model's weights with PyTorch. For full usage examples, including audio preprocessing steps and inference, please refer to the `CHBD_Vocalization_Analysis.ipynb` notebook provided in this repository.
69
 
70
  ```python
 
71
  import torch
72
  import torch.nn as nn
 
73
 
74
  # Define the ModdifiedModel class
75
  # (You will need to copy this class definition from the CHBD_Vocalization_Analysis.ipynb file)
@@ -84,10 +86,12 @@ class ModdifiedModel(nn.Module):
84
  # Instantiate the model
85
  model = ModdifiedModel(num_classes=3)
86
 
87
- # Define the path to your model weights
88
- model_weights_path = 'https://huggingface.co/IceKhoffi/chicken-vocalization-classifier/Chiken_CNN_Disease_Detection_Model.pth'
 
 
89
 
90
- state_dict = torch.hub.load_state_dict_from_url(model_weights_path, map_location='cpu')
91
  model.load_state_dict(state_dict)
92
 
93
  # Set model to evaluation mode
 
68
  You can load this trained model's weights with PyTorch. For full usage examples, including audio preprocessing steps and inference, please refer to the `CHBD_Vocalization_Analysis.ipynb` notebook provided in this repository.
69
 
70
  ```python
71
+ from huggingface_hub import hf_hub_download
72
  import torch
73
  import torch.nn as nn
74
+ import os
75
 
76
  # Define the ModdifiedModel class
77
  # (You will need to copy this class definition from the CHBD_Vocalization_Analysis.ipynb file)
 
86
  # Instantiate the model
87
  model = ModdifiedModel(num_classes=3)
88
 
89
+ # Define each Hugging Face details
90
+ repo_id = "IceKhoffi/chicken-vocalization-classifier"
91
+ filename = "Chiken_CNN_Disease_Detection_Model.pth"
92
+ model_path = hf_hub_download(repo_id=repo_id, filename=filename)
93
 
94
+ state_dict = torch.load(model_path, map_location='cpu')
95
  model.load_state_dict(state_dict)
96
 
97
  # Set model to evaluation mode