Update README.md
Browse files
README.md
CHANGED
@@ -1,10 +1,29 @@
|
|
1 |
---
|
2 |
library_name: keras
|
|
|
3 |
---
|
4 |
|
5 |
## Model description
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
## Intended uses & limitations
|
10 |
|
|
|
1 |
---
|
2 |
library_name: keras
|
3 |
+
license: mit
|
4 |
---
|
5 |
|
6 |
## Model description
|
7 |
|
8 |
+
### the hepler function
|
9 |
+
(requirements: `numpy Pillow`)
|
10 |
+
```python
|
11 |
+
import numpy as np
|
12 |
+
from PIL import Image
|
13 |
+
|
14 |
+
def predict(model, img):
|
15 |
+
pil_image = img
|
16 |
+
pil_image = pil_image.resize((64, 64))
|
17 |
+
|
18 |
+
image_array = np.array(pil_image) / 255.0
|
19 |
+
|
20 |
+
image_array = np.expand_dims(image_array, axis=0)
|
21 |
+
|
22 |
+
input_shape = (64, 64, pil_image.mode == 'RGB' and 3 or 1)
|
23 |
+
|
24 |
+
decimal_prediction = model.predict(image_array)[0][0]
|
25 |
+
return decimal_prediction
|
26 |
+
```
|
27 |
|
28 |
## Intended uses & limitations
|
29 |
|