Update pipeline.py
Browse files- 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 |
-
|
| 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 |
"""
|