Upload 3 files
Browse files- ANN.onnx +3 -0
- config.json +8 -0
- hf_serving.py +18 -0
ANN.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d14c2de9d38f36255ab5d8f2c09bbd4cda5fe041ebf2b21dbe8c73c2730ddc8
|
| 3 |
+
size 5811
|
config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "tensorflow",
|
| 3 |
+
"model_architecture": "custom",
|
| 4 |
+
"model_name": "ANN.h5",
|
| 5 |
+
"do_lower_case": false, // Depending on your model's case sensitivity
|
| 6 |
+
"framework": "tf",
|
| 7 |
+
"onnx_model": "/ANN.onnx" //If you converted to ONNX
|
| 8 |
+
}
|
hf_serving.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import tensorflow as tf
|
| 2 |
+
import huggingface_hub
|
| 3 |
+
|
| 4 |
+
model = tf.keras.models.load_model('/ANN.h5')
|
| 5 |
+
|
| 6 |
+
class CustomModel:
|
| 7 |
+
def __init__(self, model):
|
| 8 |
+
self.model = model
|
| 9 |
+
|
| 10 |
+
def __call__(self, inputs):
|
| 11 |
+
# Preprocess inputs if needed
|
| 12 |
+
processed_inputs = preprocess(inputs)
|
| 13 |
+
# Run inference
|
| 14 |
+
outputs = self.model(processed_inputs)
|
| 15 |
+
return outputs
|
| 16 |
+
|
| 17 |
+
custom_model = CustomModel(model)
|
| 18 |
+
huggingface_hub.ModelAPI(custom_model).run()
|