merve HF staff commited on
Commit
8c6372d
1 Parent(s): 6cb57f7

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +1 -11
pipeline.py CHANGED
@@ -3,8 +3,6 @@ from typing import Any, Dict, List
3
 
4
  import tensorflow as tf
5
  from tensorflow import keras
6
- from app.pipelines import Pipeline
7
- from huggingface_hub import from_pretrained_keras, hf_hub_download
8
  from PIL import Image
9
  import base64
10
 
@@ -23,15 +21,7 @@ class PreTrainedPipeline(Pipeline):
23
  # Number of labels
24
  self.num_labels = self.model.output_shape[1]
25
 
26
- # Config is required to know the mapping to label.
27
- #config_file = hf_hub_download(model_id, filename=CONFIG_FILENAME)
28
- #with open(config_file) as config:
29
- # config = json.load(config)
30
-
31
- self.num_labels = 3
32
- self.id2label = config.get(
33
- "id2label", {str(i): f"LABEL_{i}" for i in range(self.num_labels)}
34
- )
35
 
36
  def __call__(self, inputs: "Image.Image") -> List[Dict[str, Any]]:
37
  """
 
3
 
4
  import tensorflow as tf
5
  from tensorflow import keras
 
 
6
  from PIL import Image
7
  import base64
8
 
 
21
  # Number of labels
22
  self.num_labels = self.model.output_shape[1]
23
 
24
+ self.id2label = self.id2label = {"0": "pet", "1":"no_pet"}
 
 
 
 
 
 
 
 
25
 
26
  def __call__(self, inputs: "Image.Image") -> List[Dict[str, Any]]:
27
  """